Skip to content

Commit cb33ed4

Browse files
committed
C++: Only look for sensitive strings in appropriate parameters.
1 parent f1d6234 commit cb33ed4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cpp/ql/src/Security/CWE/CWE-497/SystemData.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,12 @@ class RegQuery extends SystemData {
311311
override Expr getAnExpr() { regQuery(this, TReturnData(result)) }
312312

313313
override predicate isSensitive() {
314-
this.(FunctionCall).getAnArgument().getValue().toLowerCase().regexpMatch(".*(pass|token|key).*")
314+
exists(Expr e |
315+
(
316+
regQuery(this, TSubKeyName(e)) or
317+
regQuery(this, TValueName(e))
318+
) and
319+
e.getValue().toLowerCase().regexpMatch(".*(pass|token|key).*")
320+
)
315321
}
316322
}

0 commit comments

Comments
 (0)