52 lines
777 B
Plaintext
52 lines
777 B
Plaintext
![]() |
:detections: variables/fields
|
||
|
:defaultsensibility: 3
|
||
|
|
||
|
include::../description.adoc[]
|
||
|
|
||
|
include::../ask-yourself.adoc[]
|
||
|
|
||
|
include::../recommended.adoc[]
|
||
|
|
||
|
== Sensitive Code Example
|
||
|
|
||
|
[source,go]
|
||
|
----
|
||
|
var secret = "47828a8dd77ee1eb9dde2d5e93cb221ce8c32b37" // Sensitive
|
||
|
|
||
|
func main() {
|
||
|
callMyService(secret)
|
||
|
}
|
||
|
----
|
||
|
|
||
|
== Compliant Solution
|
||
|
|
||
|
[source,go]
|
||
|
----
|
||
|
import "os"
|
||
|
|
||
|
var secret = os.Getenv("SECRET")
|
||
|
|
||
|
func main() {
|
||
|
callMyService(secret)
|
||
|
}
|
||
|
----
|
||
|
|
||
|
|
||
|
include::../see.adoc[]
|
||
|
|
||
|
* MSC - https://wiki.sei.cmu.edu/confluence/x/OjdGBQ[MSC03-J - Never hard code sensitive information]
|
||
|
|
||
|
|
||
|
ifdef::env-github,rspecator-view[]
|
||
|
'''
|
||
|
== Implementation Specification
|
||
|
(visible only on this page)
|
||
|
|
||
|
include::../message.adoc[]
|
||
|
|
||
|
|
||
|
include::../parameters.adoc[]
|
||
|
|
||
|
'''
|
||
|
endif::env-github,rspecator-view[]
|