JS: Update ImportEquals test

This commit is contained in:
Asger F
2023-10-06 15:16:48 +02:00
parent 2eff07f476
commit 85e8998067
2 changed files with 17 additions and 8 deletions

View File

@@ -1,3 +1,4 @@
legacyDataFlowDifference
dataFlowModuleImports
| ./esDefaultExport | tst.ts:1:26:1:53 | require ... xport') |
| ./esNamedExports | tst.ts:2:18:2:44 | require ... ports') |
@@ -29,4 +30,4 @@ resolution
| tst.ts:10:1:10:20 | new NodeFullExport() | nodeFullExport.ts:3:18:3:40 | class N ... port {} | tst.ts | NodeFullExport | nodeFullExport.ts |
| tst.ts:11:1:11:31 | new nod ... xport() | nodeNamedExport.ts:3:27:3:50 | class N ... port {} | tst.ts | NodeNamedExport | nodeNamedExport.ts |
taint
| test taint config | taintSource.ts:3:27:3:47 | externa ... ource() | tst.ts:18:19:18:42 | taintSo ... edValue |
| taintSource.ts:3:27:3:47 | externa ... ource() | tst.ts:18:19:18:42 | taintSo ... edValue |

View File

@@ -38,18 +38,26 @@ query predicate resolution(
klassFile = klass.getFile().getBaseName()
}
class TaintConfig extends TaintTracking::Configuration {
TaintConfig() { this = "test taint config" }
override predicate isSource(DataFlow::Node node) {
module TestConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node node) {
node = DataFlow::moduleImport("externalTaintSource").getACall()
}
override predicate isSink(DataFlow::Node node) {
predicate isSink(DataFlow::Node node) {
node = DataFlow::moduleImport("externalTaintSink").getACall().getArgument(0)
}
}
query predicate taint(TaintConfig cfg, DataFlow::Node source, DataFlow::Node sink) {
cfg.hasFlow(source, sink)
module TestFlow = TaintTracking::Global<TestConfig>;
query predicate taint = TestFlow::flow/2;
class LegacyConfig extends TaintTracking::Configuration {
LegacyConfig() { this = "LegacyConfig" }
override predicate isSource(DataFlow::Node source) { TestConfig::isSource(source) }
override predicate isSink(DataFlow::Node sink) { TestConfig::isSink(sink) }
}
import testUtilities.LegacyDataFlowDiff::DataFlowDiff<TestFlow, LegacyConfig>