File tree Expand file tree Collapse file tree 4 files changed +27
-5
lines changed
test/library-tests/TaintTracking Expand file tree Collapse file tree 4 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,22 @@ private module CollectionDataFlow {
160
160
exists ( DataFlow:: MethodCallNode call |
161
161
call = DataFlow:: globalVarRef ( [ "Map" , "Object" ] ) .getAMemberCall ( "groupBy" ) and
162
162
pred = call .getArgument ( 0 ) and
163
- succ = call
163
+ ( succ = call .getCallback ( 1 ) .getParameter ( 0 ) or succ = call .getALocalUse ( ) )
164
+ )
165
+ }
166
+ }
167
+
168
+ /**
169
+ * A step for handling data flow and taint tracking for the groupBy method on iterable objects.
170
+ * Ensures propagation of taint and data flow through the groupBy operation.
171
+ */
172
+ private class GroupByDataFlowStep extends PreCallGraphStep {
173
+ override predicate storeStep ( DataFlow:: Node pred , DataFlow:: SourceNode succ , string prop ) {
174
+ exists ( DataFlow:: MethodCallNode call |
175
+ call = DataFlow:: globalVarRef ( "Map" ) .getAMemberCall ( "groupBy" ) and
176
+ pred = call .getArgument ( 0 ) and
177
+ succ = call and
178
+ prop = mapValueUnknownKey ( )
164
179
)
165
180
}
166
181
}
Original file line number Diff line number Diff line change @@ -246,10 +246,15 @@ typeInferenceMismatch
246
246
| tst.js:2:13:2:20 | source() | tst.js:70:10:70:18 | xReversed |
247
247
| tst.js:2:13:2:20 | source() | tst.js:72:10:72:31 | Map.gro ... z => z) |
248
248
| tst.js:2:13:2:20 | source() | tst.js:74:10:74:34 | Object. ... z => z) |
249
+ | tst.js:2:13:2:20 | source() | tst.js:78:55:78:58 | item |
249
250
| tst.js:2:13:2:20 | source() | tst.js:79:14:79:20 | grouped |
250
251
| tst.js:75:22:75:29 | source() | tst.js:75:10:75:52 | Map.gro ... (item)) |
252
+ | tst.js:75:22:75:29 | source() | tst.js:75:47:75:50 | item |
253
+ | tst.js:82:23:82:30 | source() | tst.js:83:58:83:61 | item |
251
254
| tst.js:82:23:82:30 | source() | tst.js:84:14:84:20 | grouped |
252
255
| tst.js:87:22:87:29 | source() | tst.js:90:14:90:25 | taintedValue |
256
+ | tst.js:93:22:93:29 | source() | tst.js:96:14:96:25 | taintedValue |
257
+ | tst.js:93:22:93:29 | source() | tst.js:97:14:97:26 | map.get(true) |
253
258
| xml.js:5:18:5:25 | source() | xml.js:8:14:8:17 | text |
254
259
| xml.js:12:17:12:24 | source() | xml.js:13:14:13:19 | result |
255
260
| xml.js:23:18:23:25 | source() | xml.js:20:14:20:17 | attr |
Original file line number Diff line number Diff line change 112
112
| thisAssignments.js:7:19:7:26 | source() | thisAssignments.js:8:10:8:20 | this.field2 |
113
113
| tst.js:2:13:2:20 | source() | tst.js:4:10:4:10 | x |
114
114
| tst.js:2:13:2:20 | source() | tst.js:54:14:54:19 | unsafe |
115
+ | tst.js:93:22:93:29 | source() | tst.js:96:14:96:25 | taintedValue |
116
+ | tst.js:93:22:93:29 | source() | tst.js:97:14:97:26 | map.get(true) |
Original file line number Diff line number Diff line change @@ -75,12 +75,12 @@ function test() {
75
75
sink ( Map . groupBy ( source ( ) , ( item ) => sink ( item ) ) ) ; // NOT OK
76
76
77
77
{
78
- const grouped = Map . groupBy ( x , ( item ) => sink ( item ) ) ; // NOT OK -- Should be tainted, but it is not
78
+ const grouped = Map . groupBy ( x , ( item ) => sink ( item ) ) ; // NOT OK
79
79
sink ( grouped ) ; // NOT OK
80
80
}
81
81
{
82
82
const list = [ source ( ) ] ;
83
- const grouped = Map . groupBy ( list , ( item ) => sink ( item ) ) ; // NOT OK -- Should be tainted, but it is not
83
+ const grouped = Map . groupBy ( list , ( item ) => sink ( item ) ) ; // NOT OK
84
84
sink ( grouped ) ; // NOT OK
85
85
}
86
86
{
@@ -93,7 +93,7 @@ function test() {
93
93
const data = source ( ) ;
94
94
const map = Map . groupBy ( data , item => item ) ;
95
95
const taintedValue = map . get ( true ) ;
96
- sink ( taintedValue ) ; // NOT OK -- Should be tainted, but it is not
97
- sink ( map . get ( true ) ) ; // NOT OK -- Should be tainted, but it is not
96
+ sink ( taintedValue ) ; // NOT OK
97
+ sink ( map . get ( true ) ) ; // NOT OK
98
98
}
99
99
}
You can’t perform that action at this time.
0 commit comments