Create rule S6437: Credentials should not be hard-coded (#4641)
* Add go to rule S6437 * Add description for S6437 for Go --------- Co-authored-by: daniel-teuchert-sonarsource <daniel-teuchert-sonarsource@users.noreply.github.com> Co-authored-by: Daniel Teuchert <daniel.teuchert@sonarsource.com>
This commit is contained in:
parent
a2320f1b8d
commit
e2133270e7
2
rules/S6437/go/metadata.json
Normal file
2
rules/S6437/go/metadata.json
Normal file
@ -0,0 +1,2 @@
|
||||
{
|
||||
}
|
76
rules/S6437/go/rule.adoc
Normal file
76
rules/S6437/go/rule.adoc
Normal file
@ -0,0 +1,76 @@
|
||||
include::../../../shared_content/secrets/description.adoc[]
|
||||
|
||||
== Why is this an issue?
|
||||
|
||||
include::../../../shared_content/secrets/rationale.adoc[]
|
||||
|
||||
=== What is the potential impact?
|
||||
|
||||
include::../common/impact/rationale.adoc[]
|
||||
|
||||
include::../../../shared_content/secrets/impact/financial_loss.adoc[]
|
||||
|
||||
include::../../../shared_content/secrets/impact/security_downgrade.adoc[]
|
||||
|
||||
== How to fix it
|
||||
|
||||
include::../../../shared_content/secrets/fix/revoke.adoc[]
|
||||
|
||||
include::../../../shared_content/secrets/fix/recent_use.adoc[]
|
||||
|
||||
include::../../../shared_content/secrets/fix/vault.adoc[]
|
||||
|
||||
=== Code examples
|
||||
|
||||
include::../common/fix/code-rationale.adoc[]
|
||||
|
||||
==== Noncompliant code example
|
||||
|
||||
[source,go,diff-id=1,diff-type=noncompliant]
|
||||
----
|
||||
import (
|
||||
"net/url"
|
||||
)
|
||||
|
||||
func main() {
|
||||
url.UserPassword("user", "password") // Noncompliant
|
||||
}
|
||||
----
|
||||
|
||||
==== Compliant solution
|
||||
|
||||
[source,go,diff-id=1,diff-type=compliant]
|
||||
----
|
||||
import (
|
||||
"net/url"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
url.UserPassword(os.Getenv("USER"), os.Getenv("PASSWORD"))
|
||||
}
|
||||
----
|
||||
|
||||
include::../common/fix/how-it-works.adoc[]
|
||||
|
||||
== Resources
|
||||
|
||||
include::../common/resources/documentation.adoc[]
|
||||
|
||||
include::../common/resources/standards.adoc[]
|
||||
|
||||
ifdef::env-github,rspecator-view[]
|
||||
'''
|
||||
== Implementation Specification
|
||||
(visible only on this page)
|
||||
|
||||
=== Message
|
||||
|
||||
Revoke and change this password, as it is compromised.
|
||||
|
||||
=== Highlighting
|
||||
|
||||
Highlight the credential use and its initialization.
|
||||
|
||||
'''
|
||||
endif::env-github,rspecator-view[]
|
Loading…
x
Reference in New Issue
Block a user