File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
src/semmle/javascript/dataflow
test/library-tests/InterProceduralFlow Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -473,6 +473,27 @@ module TaintTracking {
473473 }
474474 }
475475
476+ /**
477+ * A taint-propagating data flow edge from the first (and only) argument in a call to
478+ * `RegExp.prototype.exec` to its result.
479+ */
480+ private class RegExpExecTaintStep extends AdditionalTaintStep {
481+ DataFlow:: MethodCallNode self ;
482+
483+ RegExpExecTaintStep ( ) {
484+ this = self and
485+ self .getReceiver ( ) .analyze ( ) .getAType ( ) = TTRegExp ( ) and
486+ self .getMethodName ( ) = "exec" and
487+ self .getNumArgument ( ) = 1
488+ }
489+
490+
491+ override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
492+ pred = self .getArgument ( 0 ) and
493+ succ = this
494+ }
495+ }
496+
476497 /**
477498 * A taint propagating data flow edge arising from JSON unparsing.
478499 */
Original file line number Diff line number Diff line change 5050| tst.js:2:17:2:22 | "src1" | tst.js:4:15:4:29 | RegExp(source1) |
5151| tst.js:2:17:2:22 | "src1" | tst.js:5:15:5:33 | new String(source1) |
5252| tst.js:2:17:2:22 | "src1" | tst.js:6:15:6:33 | new String(source1) |
53+ | tst.js:2:17:2:22 | "src1" | tst.js:11:17:11:20 | m[0] |
5354| tst.js:2:17:2:22 | "src1" | tst.js:14:15:14:32 | decodeURI(source1) |
5455| tst.js:2:17:2:22 | "src1" | tst.js:15:15:15:41 | decodeU ... ource1) |
5556| tst.js:2:17:2:22 | "src1" | tst.js:16:15:16:32 | encodeURI(source1) |
You can’t perform that action at this time.
0 commit comments