Skip to content

Commit 837387a

Browse files
committed
Re-optimise isSensitive routine
1 parent 629a7a6 commit 837387a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,14 @@ import go
1717
import semmle.go.security.HardcodedCredentials
1818
import semmle.go.security.SensitiveActions
1919

20-
bindingset[write]
21-
pragma[inline_late]
22-
private predicate isWriteRhs(Write write, DataFlow::Node rhs) { write.getRhs() = rhs }
23-
2420
/**
2521
* Holds if `sink` is used in a context that suggests it may hold sensitive data of
2622
* the given `type`.
2723
*/
2824
predicate isSensitive(DataFlow::Node sink, SensitiveExpr::Classification type) {
2925
exists(Write write, string name |
30-
isWriteRhs(write, sink) and
31-
name = write.getLhs().getName() and
26+
pragma[only_bind_out](write).getRhs() = sink and
27+
name = pragma[only_bind_out](write).getLhs().getName() and
3228
// allow obvious test password variables
3329
not name.regexpMatch(HeuristicNames::notSensitive())
3430
|

0 commit comments

Comments
 (0)