Skip to content

Commit d8c0ab8

Browse files
committed
Go: Consider more strings as hardcoded credentials
1 parent b2e0485 commit d8c0ab8

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

go/ql/lib/semmle/go/security/HardcodedCredentials.qll

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@ module HardcodedCredentials {
3737

3838
/** A hardcoded string literal as a source for hardcoded credentials. */
3939
private class HardcodedStringSource extends Source {
40-
HardcodedStringSource() {
41-
exists(StringLit val | this.asExpr() = val |
42-
not PasswordHeuristics::isDummyPassword(val.getStringValue())
43-
)
44-
}
40+
HardcodedStringSource() { this.asExpr() instanceof StringLit }
4541
}
4642

4743
/** A use of a credential. */

go/ql/src/Security/CWE-798/HardcodedCredentials.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ where
6060
message = "Hard-coded private key."
6161
or
6262
HardcodedCredentials::Flow::flow(source, sink) and
63-
type = SensitiveExpr::password() and
64-
message = "Hard-coded credential."
63+
type = SensitiveExpr::secret() and
64+
message = "Hard-coded $@."
6565
select sink, message, source, type.toString()

0 commit comments

Comments
 (0)