Skip to content

Commit 7e4fbe2

Browse files
authored
Merge pull request github#18326 from asgerf/js/shared-dataflow-bump
JS: Merge 'main' into shared dataflow branch
2 parents 3acd481 + 942ba18 commit 7e4fbe2

File tree

51 files changed

+857
-178
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+857
-178
lines changed

javascript/ql/lib/semmle/javascript/internal/flow_summaries/Maps.qll

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
}

javascript/ql/lib/utils/test/InlineFlowTest.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ private import semmle.javascript.frameworks.data.internal.ApiGraphModelsExtensio
1111
private import internal.InlineExpectationsTestImpl
1212

1313
private module FlowTestImpl implements InputSig<Location, JSDataFlow> {
14-
import testUtilities.InlineFlowTestUtil
14+
import utils.test.InlineFlowTestUtil
1515

1616
bindingset[src, sink]
1717
string getArgString(DataFlow::Node src, DataFlow::Node sink) {

javascript/ql/test/library-tests/Arrays/DataFlow.expected

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ flow
1818
| arrays.js:2:16:2:23 | "source" | arrays.js:90:10:90:10 | x |
1919
| arrays.js:2:16:2:23 | "source" | arrays.js:93:8:93:17 | arr.at(-1) |
2020
| arrays.js:2:16:2:23 | "source" | arrays.js:110:8:110:24 | arr8_spread.pop() |
21+
| arrays.js:2:16:2:23 | "source" | arrays.js:112:8:112:33 | arr.fin ... llback) |
2122
| arrays.js:18:22:18:29 | "source" | arrays.js:18:50:18:50 | e |
2223
| arrays.js:22:15:22:22 | "source" | arrays.js:23:8:23:17 | arr2.pop() |
2324
| arrays.js:25:15:25:22 | "source" | arrays.js:26:8:26:17 | arr3.pop() |
@@ -31,3 +32,8 @@ flow
3132
| arrays.js:97:9:97:16 | "source" | arrays.js:97:8:97:42 | ["sourc ... ).pop() |
3233
| arrays.js:100:31:100:38 | "source" | arrays.js:101:8:101:17 | arr8.pop() |
3334
| arrays.js:104:55:104:62 | "source" | arrays.js:106:8:106:25 | arr8_variant.pop() |
35+
| arrays.js:115:19:115:26 | "source" | arrays.js:116:50:116:53 | item |
36+
| arrays.js:115:19:115:26 | "source" | arrays.js:117:10:117:16 | element |
37+
| arrays.js:121:19:121:26 | "source" | arrays.js:122:46:122:49 | item |
38+
| arrays.js:121:19:121:26 | "source" | arrays.js:123:10:123:16 | element |
39+
| arrays.js:127:19:127:26 | "source" | arrays.js:128:55:128:58 | item |

javascript/ql/test/library-tests/Arrays/DataFlow.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ deprecated class LegacyConfig extends DataFlow::Configuration {
2121
override predicate isSink(DataFlow::Node sink) { TestConfig::isSink(sink) }
2222
}
2323

24-
deprecated import testUtilities.LegacyDataFlowDiff::DataFlowDiff<TestFlow, LegacyConfig>
24+
deprecated import utils.test.LegacyDataFlowDiff::DataFlowDiff<TestFlow, LegacyConfig>
2525

2626
query predicate flow = TestFlow::flow/2;

javascript/ql/test/library-tests/Arrays/TaintFlow.expected

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ flow
1717
| arrays.js:2:16:2:23 | "source" | arrays.js:90:10:90:10 | x |
1818
| arrays.js:2:16:2:23 | "source" | arrays.js:93:8:93:17 | arr.at(-1) |
1919
| arrays.js:2:16:2:23 | "source" | arrays.js:110:8:110:24 | arr8_spread.pop() |
20+
| arrays.js:2:16:2:23 | "source" | arrays.js:112:8:112:33 | arr.fin ... llback) |
2021
| arrays.js:18:22:18:29 | "source" | arrays.js:18:50:18:50 | e |
2122
| arrays.js:22:15:22:22 | "source" | arrays.js:23:8:23:17 | arr2.pop() |
2223
| arrays.js:25:15:25:22 | "source" | arrays.js:26:8:26:17 | arr3.pop() |
@@ -32,3 +33,13 @@ flow
3233
| arrays.js:97:9:97:16 | "source" | arrays.js:97:8:97:42 | ["sourc ... ).pop() |
3334
| arrays.js:100:31:100:38 | "source" | arrays.js:101:8:101:17 | arr8.pop() |
3435
| arrays.js:104:55:104:62 | "source" | arrays.js:106:8:106:25 | arr8_variant.pop() |
36+
| arrays.js:115:19:115:26 | "source" | arrays.js:116:50:116:53 | item |
37+
| arrays.js:115:19:115:26 | "source" | arrays.js:117:10:117:16 | element |
38+
| arrays.js:121:19:121:26 | "source" | arrays.js:122:46:122:49 | item |
39+
| arrays.js:121:19:121:26 | "source" | arrays.js:123:10:123:16 | element |
40+
| arrays.js:127:19:127:26 | "source" | arrays.js:128:55:128:58 | item |
41+
| arrays.js:132:17:132:24 | source() | arrays.js:133:46:133:49 | item |
42+
| arrays.js:132:17:132:24 | source() | arrays.js:134:10:134:17 | element1 |
43+
| arrays.js:138:17:138:24 | source() | arrays.js:139:50:139:53 | item |
44+
| arrays.js:138:17:138:24 | source() | arrays.js:140:10:140:17 | element1 |
45+
| arrays.js:144:17:144:24 | source() | arrays.js:145:55:145:58 | item |

javascript/ql/test/library-tests/Arrays/TaintFlow.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ deprecated class LegacyConfig extends TaintTracking::Configuration {
2121
override predicate isSink(DataFlow::Node sink) { TestConfig::isSink(sink) }
2222
}
2323

24-
deprecated import testUtilities.LegacyDataFlowDiff::DataFlowDiff<TestFlow, LegacyConfig>
24+
deprecated import utils.test.LegacyDataFlowDiff::DataFlowDiff<TestFlow, LegacyConfig>
2525

2626
query predicate flow = TestFlow::flow/2;

0 commit comments

Comments
 (0)