Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create rule S6418: Hard-coded secrets are security-sensitive #4661

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions rules/S6418/go/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
51 changes: 51 additions & 0 deletions rules/S6418/go/rule.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
:detections: variables/fields
:defaultsensibility: 3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

php, javascript, and java are defining this to 5 (and none to 3). Perhaps worth keeping it consistent and/or change it across the board?


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[]
Loading