make the .filter step more precise

This commit is contained in:
Erik Krogh Kristensen
2021-05-05 13:21:37 +02:00
parent ab53f3b380
commit 4ac21e9f3f

View File

@@ -36,10 +36,13 @@ module ArrayTaintTracking {
succ = call
)
or
// `array.filter` keeps the taint
// `array.filter(x => x)` keeps the taint
call.(DataFlow::MethodCallNode).getMethodName() = "filter" and
pred = call.getReceiver() and
succ = call
succ = call and
exists(DataFlow::FunctionNode callback | callback = call.getArgument(0).getAFunctionValue() |
callback.getParameter(0).getALocalUse() = callback.getAReturn()
)
or
// `array.reduce` with tainted value in callback
call.(DataFlow::MethodCallNode).getMethodName() = "reduce" and