Skip to content

Commit 7b1ef74

Browse files
committed
change ArrayCreationStep to a PreCallGraphStep and unrestrict the storeStep
1 parent b944005 commit 7b1ef74

File tree

6 files changed

+7
-6
lines changed

6 files changed

+7
-6
lines changed

javascript/ql/lib/semmle/javascript/Arrays.qll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,12 @@ private module ArrayDataFlow {
261261
/**
262262
* A step for creating an array and storing the elements in the array.
263263
*/
264-
private class ArrayCreationStep extends DataFlow::SharedFlowStep {
264+
private class ArrayCreationStep extends PreCallGraphStep {
265265
override predicate storeStep(DataFlow::Node element, DataFlow::SourceNode obj, string prop) {
266266
exists(DataFlow::ArrayCreationNode array, int i |
267267
element = array.getElement(i) and
268268
obj = array and
269-
if array = any(PromiseAllCreation c).getArrayNode()
270-
then prop = arrayElement(i)
271-
else prop = arrayElement()
269+
prop = arrayElement(i)
272270
)
273271
}
274272
}

javascript/ql/test/library-tests/InterProceduralFlow/tests.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dataFlow
1414
| callback.js:16:14:16:21 | "source" | callback.js:13:14:13:14 | x |
1515
| callback.js:17:15:17:23 | "source2" | callback.js:13:14:13:14 | x |
1616
| callback.js:27:15:27:23 | "source3" | callback.js:13:14:13:14 | x |
17+
| destructuring.js:2:16:2:24 | "tainted" | destructuring.js:5:14:5:20 | tainted |
1718
| destructuring.js:2:16:2:24 | "tainted" | destructuring.js:9:15:9:22 | tainted2 |
1819
| destructuring.js:19:15:19:23 | "tainted" | destructuring.js:14:15:14:15 | p |
1920
| destructuring.js:20:15:20:28 | "also tainted" | destructuring.js:15:15:15:15 | r |
@@ -201,6 +202,7 @@ germanFlow
201202
| callback.js:17:15:17:23 | "source2" | callback.js:13:14:13:14 | x |
202203
| callback.js:27:15:27:23 | "source3" | callback.js:13:14:13:14 | x |
203204
| custom.js:1:14:1:26 | "verschmutzt" | custom.js:2:15:2:20 | quelle |
205+
| destructuring.js:2:16:2:24 | "tainted" | destructuring.js:5:14:5:20 | tainted |
204206
| destructuring.js:2:16:2:24 | "tainted" | destructuring.js:9:15:9:22 | tainted2 |
205207
| destructuring.js:19:15:19:23 | "tainted" | destructuring.js:14:15:14:15 | p |
206208
| destructuring.js:20:15:20:28 | "also tainted" | destructuring.js:15:15:15:15 | r |

javascript/ql/test/library-tests/frameworks/Collections/test.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ typeTracking
2424
| tst.js:2:16:2:23 | source() | tst.js:29:14:29:14 | e |
2525
| tst.js:2:16:2:23 | source() | tst.js:33:14:33:14 | e |
2626
| tst.js:2:16:2:23 | source() | tst.js:37:14:37:14 | e |
27+
| tst.js:2:16:2:23 | source() | tst.js:41:14:41:14 | e |
2728
| tst.js:2:16:2:23 | source() | tst.js:45:14:45:14 | e |
2829
| tst.js:2:16:2:23 | source() | tst.js:53:8:53:21 | map.get("key") |
2930
| tst.js:2:16:2:23 | source() | tst.js:59:8:59:22 | map2.get("foo") |

javascript/ql/test/library-tests/frameworks/Collections/tst.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
}
4040

4141
for (const e of new Set([source])) {
42-
sink(e); // NOT OK (not caught by type-tracking, as it doesn't include array steps).
42+
sink(e); // NOT OK
4343
}
4444

4545
for (const e of new Set(set)) {

javascript/ql/test/library-tests/frameworks/HTTP-heuristics/UnpromotedRouteHandlerCandidate.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
| src/hapi.js:1:1:1:30 | functio ... t, h){} | A `RouteHandlerCandidate` that did not get promoted to `RouteHandler`, and it is not used in a `RouteSetupCandidate`. |
2-
| src/iterated-handlers.js:4:2:4:22 | functio ... res){} | A `RouteHandlerCandidate` that did not get promoted to `RouteHandler`, and it is not used in a `RouteSetupCandidate`. |
32
| src/route-objects.js:7:19:7:38 | function(req, res){} | A `RouteHandlerCandidate` that did not get promoted to `RouteHandler`, and it is not used in a `RouteSetupCandidate`. |
43
| src/route-objects.js:8:12:10:5 | (req, res) {\\n\\n } | A `RouteHandlerCandidate` that did not get promoted to `RouteHandler`, and it is not used in a `RouteSetupCandidate`. |
54
| src/route-objects.js:20:16:22:9 | (req, r ... } | A `RouteHandlerCandidate` that did not get promoted to `RouteHandler`, and it is not used in a `RouteSetupCandidate`. |

javascript/ql/test/library-tests/frameworks/HTTP-heuristics/tests.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ routeHandler
1616
| src/exported-middleware-attacher.js:2:13:2:32 | function(req, res){} |
1717
| src/handler-in-property.js:5:14:5:33 | function(req, res){} |
1818
| src/handler-in-property.js:12:18:12:37 | function(req, res){} |
19+
| src/iterated-handlers.js:4:2:4:22 | functio ... res){} |
1920
| src/middleware-attacher-getter.js:4:17:4:36 | function(req, res){} |
2021
| src/middleware-attacher-getter.js:19:19:19:38 | function(req, res){} |
2122
| src/middleware-attacher-getter.js:29:32:29:51 | function(req, res){} |

0 commit comments

Comments
 (0)