File tree Expand file tree Collapse file tree
javascript/ql/lib/semmle/javascript Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88import javascript
99private import semmle.javascript.dataflow.InferredTypes
10+ private import semmle.javascript.internal.CachedStages
1011
1112/**
1213 * An element containing a regular expression term, that is, either
@@ -955,7 +956,9 @@ private predicate isUsedAsNonMatchObject(DataFlow::MethodCallNode call) {
955956/**
956957 * Holds if `source` may be interpreted as a regular expression.
957958 */
959+ cached
958960predicate isInterpretedAsRegExp ( DataFlow:: Node source ) {
961+ Stages:: Taint:: ref ( ) and
959962 source .analyze ( ) .getAType ( ) = TTString ( ) and
960963 (
961964 // 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 {
260260 exists ( RemoteFlowSource r )
261261 or
262262 exists ( Exports:: getALibraryInputParameter ( ) )
263+ or
264+ any ( RegExpTerm t ) .isUsedAsRegExp ( )
263265 }
264266 }
265267}
You can’t perform that action at this time.
0 commit comments