JS: Port Collections test

This commit is contained in:
Asger F
2023-10-05 15:07:42 +02:00
parent 466ffdf8f5
commit 09892279e6
2 changed files with 32 additions and 23 deletions

View File

@@ -1,19 +1,4 @@
dataFlow
| tst.js:2:16:2:23 | source() | tst.js:7:7:7:7 | e |
| tst.js:2:16:2:23 | source() | tst.js:11:10:11:10 | e |
| tst.js:2:16:2:23 | source() | tst.js:17:10:17:10 | v |
| tst.js:2:16:2:23 | source() | tst.js:21:10:21:14 | value |
| tst.js:2:16:2:23 | source() | tst.js:26:10:26:14 | value |
| tst.js:2:16:2:23 | source() | tst.js:30:7:30:7 | e |
| tst.js:2:16:2:23 | source() | tst.js:34:7:34:7 | e |
| tst.js:2:16:2:23 | source() | tst.js:38:7:38:7 | e |
| tst.js:2:16:2:23 | source() | tst.js:42:7:42:7 | e |
| tst.js:2:16:2:23 | source() | tst.js:46:7:46:7 | e |
| tst.js:2:16:2:23 | source() | tst.js:50:10:50:10 | e |
| tst.js:2:16:2:23 | source() | tst.js:53:8:53:21 | map.get("key") |
| tst.js:2:16:2:23 | source() | tst.js:59:8:59:22 | map2.get("foo") |
| tst.js:2:16:2:23 | source() | tst.js:64:8:64:26 | map3.get(unknown()) |
| tst.js:2:16:2:23 | source() | tst.js:69:8:69:26 | map3.get(unknown()) |
legacyDataFlowDifference
typeTracking
| tst.js:2:16:2:23 | source() | tst.js:2:16:2:23 | source() |
| tst.js:2:16:2:23 | source() | tst.js:6:14:6:14 | e |
@@ -30,3 +15,19 @@ typeTracking
| tst.js:2:16:2:23 | source() | tst.js:59:8:59:22 | map2.get("foo") |
| tst.js:2:16:2:23 | source() | tst.js:64:8:64:26 | map3.get(unknown()) |
| tst.js:2:16:2:23 | source() | tst.js:69:8:69:26 | map3.get(unknown()) |
dataFlow
| tst.js:2:16:2:23 | source() | tst.js:7:7:7:7 | e |
| tst.js:2:16:2:23 | source() | tst.js:11:10:11:10 | e |
| tst.js:2:16:2:23 | source() | tst.js:17:10:17:10 | v |
| tst.js:2:16:2:23 | source() | tst.js:21:10:21:14 | value |
| tst.js:2:16:2:23 | source() | tst.js:26:10:26:14 | value |
| tst.js:2:16:2:23 | source() | tst.js:30:7:30:7 | e |
| tst.js:2:16:2:23 | source() | tst.js:34:7:34:7 | e |
| tst.js:2:16:2:23 | source() | tst.js:38:7:38:7 | e |
| tst.js:2:16:2:23 | source() | tst.js:42:7:42:7 | e |
| tst.js:2:16:2:23 | source() | tst.js:46:7:46:7 | e |
| tst.js:2:16:2:23 | source() | tst.js:50:10:50:10 | e |
| tst.js:2:16:2:23 | source() | tst.js:53:8:53:21 | map.get("key") |
| tst.js:2:16:2:23 | source() | tst.js:59:8:59:22 | map2.get("foo") |
| tst.js:2:16:2:23 | source() | tst.js:64:8:64:26 | map3.get(unknown()) |
| tst.js:2:16:2:23 | source() | tst.js:69:8:69:26 | map3.get(unknown()) |

View File

@@ -1,21 +1,29 @@
import javascript
class Config extends DataFlow::Configuration {
Config() { this = "Config" }
override predicate isSource(DataFlow::Node source) {
module TestConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
source.(DataFlow::CallNode).getCalleeName() = "source"
}
override predicate isSink(DataFlow::Node sink) {
predicate isSink(DataFlow::Node sink) {
exists(DataFlow::CallNode call | call.getCalleeName() = "sink" | call.getAnArgument() = sink)
}
}
query predicate dataFlow(DataFlow::Node pred, DataFlow::Node succ) {
any(Config c).hasFlow(pred, succ)
module TestFlow = DataFlow::Global<TestConfig>;
query predicate dataFlow = TestFlow::flow/2;
class LegacyConfig extends DataFlow::Configuration {
LegacyConfig() { this = "Config" }
override predicate isSource(DataFlow::Node source) { TestConfig::isSource(source) }
override predicate isSink(DataFlow::Node sink) { TestConfig::isSink(sink) }
}
import testUtilities.LegacyDataFlowDiff::DataFlowDiff<TestFlow, LegacyConfig>
DataFlow::SourceNode trackSource(DataFlow::TypeTracker t, DataFlow::SourceNode start) {
t.start() and
result.(DataFlow::CallNode).getCalleeName() = "source" and