File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
javascript/ql/lib/semmle/javascript Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change 7
7
8
8
import javascript
9
9
private import semmle.javascript.dataflow.InferredTypes
10
+ private import semmle.javascript.internal.CachedStages
10
11
11
12
/**
12
13
* An element containing a regular expression term, that is, either
@@ -955,7 +956,9 @@ private predicate isUsedAsNonMatchObject(DataFlow::MethodCallNode call) {
955
956
/**
956
957
* Holds if `source` may be interpreted as a regular expression.
957
958
*/
959
+ cached
958
960
predicate isInterpretedAsRegExp ( DataFlow:: Node source ) {
961
+ Stages:: Taint:: ref ( ) and
959
962
source .analyze ( ) .getAType ( ) = TTString ( ) and
960
963
(
961
964
// The first argument to an invocation of `RegExp` (with or without `new`).
Original file line number Diff line number Diff line change @@ -260,6 +260,8 @@ module Stages {
260
260
exists ( RemoteFlowSource r )
261
261
or
262
262
exists ( Exports:: getALibraryInputParameter ( ) )
263
+ or
264
+ any ( RegExpTerm t ) .isUsedAsRegExp ( )
263
265
}
264
266
}
265
267
}
You can’t perform that action at this time.
0 commit comments