Skip to content

Commit

Permalink
Update RegExp handling and add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Napalys authored Nov 28, 2024
1 parent fd77360 commit 051ff39
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module CleartextLogging {
exists(this.getRawReplacement().getStringValue()) and
exists(DataFlow::RegExpCreationNode regexpObj |
this.(StringReplaceCall).getRegExp() = regexpObj and
regexpObj.getRoot() = any(RegExpDot term)
regexpObj.getRoot() = any(RegExpDot term).getRootTerm()
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,5 @@ const debug = require('debug')('test');
console.log(password.replace(new RegExp(".", "g"), "*")); // OK
console.log(password.replace(new RegExp("."), "*")); // NOT OK
console.log(password.replace(new RegExp(".", unknownFlags()), "*")); // OK -- Most likely not a problem.
console.log(password.replace(new RegExp("pre_._suf", "g"), "*")); // OK
})();

0 comments on commit 051ff39

Please sign in to comment.