Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 66dcd7d

Browse files
committed
JavaScript: add taint step from return value of 'map' callback
1 parent 0c124d2 commit 66dcd7d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

javascript/ql/src/semmle/javascript/dataflow/TaintTracking.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,13 @@ module TaintTracking {
207207
this = DataFlow::parameterNode(p) and
208208
pred.asExpr() = m.getReceiver()
209209
)
210+
or
211+
// `array.map` with tainted return value in callback
212+
exists (MethodCallExpr m, Function f |
213+
this.asExpr() = m and
214+
m.getMethodName() = "map" and
215+
m.getArgument(0) = f and // Require the argument to be a closure to avoid spurious call/return flow
216+
pred = f.getAReturnedExpr().flow())
210217
)
211218
or
212219
// reading from a tainted object yields a tainted result

0 commit comments

Comments
 (0)