rspec/rules/S2068/go/rule.adoc
2025-03-27 09:26:11 +00:00

53 lines
859 B
Plaintext

include::../description.adoc[]
include::../ask-yourself.adoc[]
include::../recommended.adoc[]
=== Exceptions
* The rule ignores string literals that are used directly in Regexp methods.
== Sensitive Code Example
----
func connect() {
user := "root"
password:= "supersecret" // Sensitive
url := "login=" + user + "&passwd=" + password
}
----
== Compliant Solution
[source,go]
----
func connect() {
user := getEncryptedUser()
password:= getEncryptedPass() // Compliant
url := "login=" + user + "&passwd=" + password
}
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../parameters.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]