File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
javascript/ql/lib/semmle/javascript Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -36,12 +36,18 @@ module ArrayTaintTracking {
36
36
succ = call
37
37
)
38
38
or
39
- // `array.filter(x => x)` keeps the taint
39
+ // `array.filter(x => x)` and `array.filter(x => !!x)` keeps the taint
40
40
call .( DataFlow:: MethodCallNode ) .getMethodName ( ) = "filter" and
41
41
pred = call .getReceiver ( ) and
42
42
succ = call and
43
- exists ( DataFlow:: FunctionNode callback | callback = call .getArgument ( 0 ) .getAFunctionValue ( ) |
44
- callback .getParameter ( 0 ) .getALocalUse ( ) = callback .getAReturn ( )
43
+ exists ( DataFlow:: FunctionNode callback , DataFlow:: Node param , DataFlow:: Node ret |
44
+ callback = call .getArgument ( 0 ) .getAFunctionValue ( ) and
45
+ param = callback .getParameter ( 0 ) .getALocalUse ( ) and
46
+ ret = callback .getAReturn ( )
47
+ |
48
+ param = ret
49
+ or
50
+ param = DataFlow:: exprNode ( ret .asExpr ( ) .( LogNotExpr ) .getOperand ( ) .( LogNotExpr ) .getOperand ( ) )
45
51
)
46
52
or
47
53
// `array.reduce` with tainted value in callback
You can’t perform that action at this time.
0 commit comments