Skip to content

Commit 1f931d6

Browse files
committed
rb/hardcoded-credentials: fix bad bracketing
1 parent fdd4f7f commit 1f931d6

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,12 @@ private DataFlow::Node credentialParameter() {
108108
private Expr credentialComparison() {
109109
exists(EqualityOperation op, VariableReadAccess vra |
110110
maybeCredentialName(vra.getVariable().getName()) and
111-
op.getLeftOperand() = result and
112-
op.getRightOperand() = vra
113-
or
114-
op.getLeftOperand() = vra and op.getRightOperand() = result
111+
(
112+
op.getLeftOperand() = result and
113+
op.getRightOperand() = vra
114+
or
115+
op.getLeftOperand() = vra and op.getRightOperand() = result
116+
)
115117
)
116118
}
117119

@@ -147,4 +149,5 @@ class HardcodedCredentialsConfiguration extends DataFlow::Configuration {
147149
from DataFlow::PathNode source, DataFlow::PathNode sink, HardcodedCredentialsConfiguration conf
148150
where conf.hasFlowPath(source, sink)
149151
select sink.getNode(), source, sink, "Use of $@.", source.getNode(), "hardcoded credentials"
152+
150153
// TODO: debug duplicate rows

0 commit comments

Comments
 (0)