Skip to content

Commit 16284fd

Browse files
committed
Discard sources that are obvious dummy values
1 parent a76de49 commit 16284fd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import go
88
private import semmle.go.StringOps
99
private import semmle.go.dataflow.ExternalFlow
10+
private import semmle.go.security.SensitiveActions
1011

1112
/**
1213
* Provides default sources, sinks and sanitizers for reasoning about
@@ -36,7 +37,11 @@ module HardcodedCredentials {
3637

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

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

0 commit comments

Comments
 (0)