File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
javascript/ql/src/semmle/javascript Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,11 @@ class StringReplaceCall extends DataFlow::MethodCallNode {
121
121
*/
122
122
DataFlow:: Node getRawReplacement ( ) { result = getArgument ( 1 ) }
123
123
124
+ /**
125
+ * Gets a function flowing into the second argument of this call to `replace`.
126
+ */
127
+ DataFlow:: FunctionNode getReplacementCallback ( ) { result = getCallback ( 1 ) }
128
+
124
129
/**
125
130
* Holds if this is a global replacement, that is, the first argument is a regular expression
126
131
* with the `g` flag.
Original file line number Diff line number Diff line change @@ -757,9 +757,8 @@ module TaintTracking {
757
757
private predicate staticRegExpCaptureStep ( DataFlow:: Node pred , DataFlow:: Node succ ) {
758
758
getACaptureSetter ( pred ) = getANodeReachingCaptureRef ( succ )
759
759
or
760
- exists ( DataFlow:: MethodCallNode replace |
761
- replace .getMethodName ( ) = "replace" and
762
- getANodeReachingCaptureRef ( succ ) = replace .getCallback ( 1 ) .getFunction ( ) .getEntry ( ) and
760
+ exists ( StringReplaceCall replace |
761
+ getANodeReachingCaptureRef ( succ ) = replace .getReplacementCallback ( ) .getFunction ( ) .getEntry ( ) and
763
762
pred = replace .getReceiver ( )
764
763
)
765
764
}
You can’t perform that action at this time.
0 commit comments