File tree Expand file tree Collapse file tree 4 files changed +24
-2
lines changed
lib/semmle/javascript/internal/flow_summaries
test/library-tests/TaintTracking Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -118,3 +118,23 @@ class MapSet extends SummarizedCallable {
118
118
)
119
119
}
120
120
}
121
+
122
+ class MapGroupBy extends SummarizedCallable {
123
+ MapGroupBy ( ) { this = "Map#groupBy" }
124
+
125
+ override DataFlow:: CallNode getACallSimple ( ) {
126
+ result = mapConstructorRef ( ) .getAMemberCall ( "groupBy" ) and
127
+ result .getNumArgument ( ) = 2
128
+ }
129
+
130
+ override predicate propagatesFlow ( string input , string output , boolean preservesValue ) {
131
+ preservesValue = true and
132
+ (
133
+ input = "Argument[0].ArrayElement" and
134
+ output = [ "Argument[1].Parameter[0]" , "ReturnValue.MapValue.ArrayElement" ]
135
+ or
136
+ input = "Argument[1].ReturnValue" and
137
+ output = "ReturnValue.MapKey"
138
+ )
139
+ }
140
+ }
Original file line number Diff line number Diff line change @@ -35,7 +35,6 @@ legacyDataFlowDifference
35
35
| spread.js:4:15:4:22 | source() | spread.js:18:8:18:8 | y | only flow with NEW data flow library |
36
36
| spread.js:4:15:4:22 | source() | spread.js:24:8:24:8 | y | only flow with NEW data flow library |
37
37
| tst.js:2:13:2:20 | source() | tst.js:17:10:17:10 | a | only flow with OLD data flow library |
38
- | tst.js:82:23:82:30 | source() | tst.js:83:58:83:61 | item | only flow with OLD data flow library |
39
38
| tst.js:82:23:82:30 | source() | tst.js:84:14:84:20 | grouped | only flow with OLD data flow library |
40
39
| use-use-after-implicit-read.js:7:17:7:24 | source() | use-use-after-implicit-read.js:15:10:15:10 | x | only flow with NEW data flow library |
41
40
consistencyIssue
321
320
| tst.js:2:13:2:20 | source() | tst.js:102:10:102:14 | xWith |
322
321
| tst.js:75:22:75:29 | source() | tst.js:75:10:75:52 | Map.gro ... (item)) |
323
322
| tst.js:75:22:75:29 | source() | tst.js:75:47:75:50 | item |
323
+ | tst.js:82:23:82:30 | source() | tst.js:83:58:83:61 | item |
324
324
| tst.js:87:22:87:29 | source() | tst.js:90:14:90:25 | taintedValue |
325
325
| tst.js:93:22:93:29 | source() | tst.js:96:14:96:25 | taintedValue |
326
326
| 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 @@ -27,6 +27,7 @@ legacyDataFlowDifference
27
27
| spread.js:4:15:4:22 | source() | spread.js:24:8:24:8 | y | only flow with NEW data flow library |
28
28
| tst.js:2:13:2:20 | source() | tst.js:35:14:35:16 | ary | only flow with NEW data flow library |
29
29
| tst.js:2:13:2:20 | source() | tst.js:41:14:41:16 | ary | only flow with NEW data flow library |
30
+ | tst.js:82:23:82:30 | source() | tst.js:83:58:83:61 | item | only flow with NEW data flow library |
30
31
| use-use-after-implicit-read.js:7:17:7:24 | source() | use-use-after-implicit-read.js:15:10:15:10 | x | only flow with NEW data flow library |
31
32
flow
32
33
| access-path-sanitizer.js:2:18:2:25 | source() | access-path-sanitizer.js:4:8:4:12 | obj.x |
190
191
| tst.js:2:13:2:20 | source() | tst.js:35:14:35:16 | ary |
191
192
| tst.js:2:13:2:20 | source() | tst.js:41:14:41:16 | ary |
192
193
| tst.js:2:13:2:20 | source() | tst.js:54:14:54:19 | unsafe |
194
+ | tst.js:82:23:82:30 | source() | tst.js:83:58:83:61 | item |
193
195
| tst.js:93:22:93:29 | source() | tst.js:96:14:96:25 | taintedValue |
194
196
| tst.js:93:22:93:29 | source() | tst.js:97:14:97:26 | map.get(true) |
195
197
| use-use-after-implicit-read.js:7:17:7:24 | source() | use-use-after-implicit-read.js:15:10:15:10 | x |
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ function test() {
80
80
}
81
81
{
82
82
const list = [ source ( ) ] ;
83
- const grouped = Map . groupBy ( list , ( item ) => sink ( item ) ) ; // NOT OK [INCONSISTENCY]
83
+ const grouped = Map . groupBy ( list , ( item ) => sink ( item ) ) ; // NOT OK
84
84
sink ( grouped ) ; // NOT OK [INCONSISTENCY]
85
85
}
86
86
{
You can’t perform that action at this time.
0 commit comments