Skip to content

Commit 9ca0fe4

Browse files
Napalyserik-krogh
andcommitted
Update RegExp handling and add test case
Co-authored-by: erik-krogh <[email protected]>
1 parent fd77360 commit 9ca0fe4

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

javascript/ql/lib/semmle/javascript/security/dataflow/CleartextLoggingCustomizations.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module CleartextLogging {
4040
exists(this.getRawReplacement().getStringValue()) and
4141
exists(DataFlow::RegExpCreationNode regexpObj |
4242
this.(StringReplaceCall).getRegExp() = regexpObj and
43-
regexpObj.getRoot() = any(RegExpDot term)
43+
regexpObj.getRoot() = any(RegExpDot term).getRootTerm()
4444
)
4545
}
4646
}

javascript/ql/test/query-tests/Security/CWE-312/passwords.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,5 @@ const debug = require('debug')('test');
181181
console.log(password.replace(new RegExp(".", "g"), "*")); // OK
182182
console.log(password.replace(new RegExp("."), "*")); // NOT OK
183183
console.log(password.replace(new RegExp(".", unknownFlags()), "*")); // OK -- Most likely not a problem.
184+
console.log(password.replace(new RegExp("pre_._suf", "g"), "*")); // OK
184185
})();

0 commit comments

Comments
 (0)