File tree Expand file tree Collapse file tree 7 files changed +55
-2
lines changed
Expand file tree Collapse file tree 7 files changed +55
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ module StringConcatenation {
1010 result = expr .flow ( )
1111 or
1212 exists ( SsaExplicitDefinition def | def .getDef ( ) = expr |
13- result = DataFlow:: valueNode ( def . getVariable ( ) . getAUse ( ) )
13+ result = DataFlow:: ssaDefinitionNode ( def )
1414 )
1515 }
1616
Original file line number Diff line number Diff line change @@ -366,7 +366,9 @@ module TaintTracking {
366366 * Note that since we cannot easily distinguish string append from addition,
367367 * we consider any `+` operation to propagate taint.
368368 */
369- class StringConcatenationTaintStep extends AdditionalTaintStep , DataFlow:: ValueNode {
369+ class StringConcatenationTaintStep extends AdditionalTaintStep {
370+ StringConcatenationTaintStep ( ) { StringConcatenation:: taintStep ( _, this ) }
371+
370372 override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
371373 succ = this and
372374 StringConcatenation:: taintStep ( pred , succ )
Original file line number Diff line number Diff line change 99| tst.js:5:3:5:3 | x |
1010| tst.js:5:3:5:13 | x += "four" |
1111| tst.js:6:10:6:10 | x |
12+ | tst.js:12:5:12:5 | x |
1213| tst.js:12:5:12:26 | x += "o ... + "two" |
1314| tst.js:12:10:12:26 | "one" + y + "two" |
1415| tst.js:12:22:12:26 | "two" |
16+ | tst.js:14:3:14:3 | x |
17+ | tst.js:14:3:14:13 | x += "last" |
18+ | tst.js:15:10:15:10 | x |
1519| tst.js:19:11:19:23 | "one" + "two" |
1620| tst.js:19:19:19:23 | "two" |
1721| tst.js:20:3:20:3 | x |
3337| tst.js:53:19:53:23 | two |
3438| tst.js:71:14:71:18 | "two" |
3539| tst.js:77:23:77:27 | "two" |
40+ | tst.js:87:5:87:14 | x += 'two' |
41+ | tst.js:87:10:87:14 | 'two' |
42+ | tst.js:89:3:89:3 | x |
43+ | tst.js:89:3:89:14 | x += 'three' |
44+ | tst.js:90:10:90:10 | x |
Original file line number Diff line number Diff line change 99| tst.js:5:3:5:3 | x |
1010| tst.js:5:3:5:13 | x += "four" |
1111| tst.js:6:10:6:10 | x |
12+ | tst.js:12:5:12:5 | x |
1213| tst.js:12:5:12:26 | x += "o ... + "two" |
1314| tst.js:12:10:12:26 | "one" + y + "two" |
1415| tst.js:12:22:12:26 | "two" |
16+ | tst.js:14:3:14:3 | x |
17+ | tst.js:14:3:14:13 | x += "last" |
18+ | tst.js:15:10:15:10 | x |
1519| tst.js:19:11:19:23 | "one" + "two" |
1620| tst.js:19:19:19:23 | "two" |
1721| tst.js:20:3:20:3 | x |
3337| tst.js:53:19:53:23 | two |
3438| tst.js:71:14:71:18 | "two" |
3539| tst.js:77:23:77:27 | "two" |
40+ | tst.js:87:5:87:14 | x += 'two' |
41+ | tst.js:87:10:87:14 | 'two' |
42+ | tst.js:89:3:89:3 | x |
43+ | tst.js:89:3:89:14 | x += 'three' |
44+ | tst.js:90:10:90:10 | x |
Original file line number Diff line number Diff line change @@ -80,3 +80,12 @@ function joinInClosure() {
8080 }
8181 return f ( ) ;
8282}
83+
84+ function addExprPhi ( b ) {
85+ let x = 'one' ;
86+ if ( b ) {
87+ x += 'two' ;
88+ }
89+ x += 'three' ;
90+ return x ;
91+ }
Original file line number Diff line number Diff line change 1+ | addexpr.js:4:10:4:17 | source() | addexpr.js:7:8:7:8 | x |
2+ | addexpr.js:11:15:11:22 | source() | addexpr.js:21:8:21:12 | value |
13| advanced-callgraph.js:2:13:2:20 | source() | advanced-callgraph.js:6:22:6:22 | v |
24| callbacks.js:4:6:4:13 | source() | callbacks.js:34:27:34:27 | x |
35| callbacks.js:4:6:4:13 | source() | callbacks.js:35:27:35:27 | x |
Original file line number Diff line number Diff line change 1+ function test1 ( b ) {
2+ let x = 'one' ;
3+ if ( b ) {
4+ x += source ( ) ;
5+ }
6+ x += 'three' ;
7+ sink ( x ) ; // NOT OK
8+ }
9+
10+ function test2 ( x , foo ) {
11+ let taint = source ( ) ;
12+ let value = '' ;
13+
14+ sink ( value ) ; // OK
15+
16+ if ( x ) {
17+ value += taint ;
18+ }
19+ value += foo ;
20+
21+ sink ( value ) ; // NOT OK
22+ }
You can’t perform that action at this time.
0 commit comments