Skip to content

Commit a1ca88d

Browse files
committed
JS: Added test cases with new RegExp for Tainted paths, currently works only with literals
1 parent 7e5ea52 commit a1ca88d

File tree

4 files changed

+326
-3
lines changed

4 files changed

+326
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ module TaintedPath {
221221
this instanceof StringReplaceCall and
222222
input = this.getReceiver() and
223223
output = this and
224-
not exists(RegExpLiteral literal, RegExpTerm term |
225-
this.(StringReplaceCall).getRegExp().asExpr() = literal and
224+
not exists(DataFlow::RegExpCreationNode regexp, RegExpTerm term |
225+
this.(StringReplaceCall).getRegExp() = regexp and
226226
this.(StringReplaceCall).isGlobal() and
227-
literal.getRoot() = term
227+
regexp.getRoot() = term
228228
|
229229
term.getAMatchedString() = "/" or
230230
term.getAMatchedString() = "." or
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| TaintedPath.js:207 | did not expect an alert, but found an alert for TaintedPath | OK -- Might be okay depending on what unknownFlags evaluates to. | |

0 commit comments

Comments
 (0)