Skip to content

Commit 8839d4c

Browse files
committed
limit additional flow steps in rb/hardcoded-credentials to string concatenation
1 parent fe45dad commit 8839d4c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

ql/src/queries/security/cwe-798/HardcodedCredentials.ql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,14 @@ class HardcodedCredentialsConfiguration extends DataFlow::Configuration {
136136
override predicate isSink(DataFlow::Node sink) { sink instanceof CredentialSink }
137137

138138
override predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
139-
// e.g. string concatenation
140139
exists(ExprNodes::BinaryOperationCfgNode binop |
141140
(
142141
binop.getLeftOperand() = node1.asExpr() or
143142
binop.getRightOperand() = node1.asExpr()
144143
) and
145-
binop = node2.asExpr()
144+
binop = node2.asExpr() and
145+
// string concatenation
146+
binop.getExpr() instanceof AddExpr
146147
)
147148
}
148149
}

0 commit comments

Comments
 (0)