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 {
118118 )
119119 }
120120}
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
3535| spread.js:4:15:4:22 | source() | spread.js:18:8:18:8 | y | only flow with NEW data flow library |
3636| spread.js:4:15:4:22 | source() | spread.js:24:8:24:8 | y | only flow with NEW data flow library |
3737| 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 |
3938| tst.js:82:23:82:30 | source() | tst.js:84:14:84:20 | grouped | only flow with OLD data flow library |
4039| 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 |
4140consistencyIssue
321320| tst.js:2:13:2:20 | source() | tst.js:102:10:102:14 | xWith |
322321| tst.js:75:22:75:29 | source() | tst.js:75:10:75:52 | Map.gro ... (item)) |
323322| 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 |
324324| tst.js:87:22:87:29 | source() | tst.js:90:14:90:25 | taintedValue |
325325| tst.js:93:22:93:29 | source() | tst.js:96:14:96:25 | taintedValue |
326326| 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
2727| spread.js:4:15:4:22 | source() | spread.js:24:8:24:8 | y | only flow with NEW data flow library |
2828| tst.js:2:13:2:20 | source() | tst.js:35:14:35:16 | ary | only flow with NEW data flow library |
2929| 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 |
3031| 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 |
3132flow
3233| access-path-sanitizer.js:2:18:2:25 | source() | access-path-sanitizer.js:4:8:4:12 | obj.x |
190191| tst.js:2:13:2:20 | source() | tst.js:35:14:35:16 | ary |
191192| tst.js:2:13:2:20 | source() | tst.js:41:14:41:16 | ary |
192193| 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 |
193195| tst.js:93:22:93:29 | source() | tst.js:96:14:96:25 | taintedValue |
194196| tst.js:93:22:93:29 | source() | tst.js:97:14:97:26 | map.get(true) |
195197| 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() {
8080 }
8181 {
8282 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
8484 sink ( grouped ) ; // NOT OK [INCONSISTENCY]
8585 }
8686 {
You can’t perform that action at this time.
0 commit comments