mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
JS: Port ComposedFunctions test
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
legacyDataFlowDifference
|
||||
#select
|
||||
| tst.js:10:10:10:15 | source |
|
||||
| tst.js:15:10:15:13 | f1() |
|
||||
| tst.js:20:10:20:24 | lcompose1(f2)() |
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import javascript
|
||||
|
||||
class ExampleConfiguration extends TaintTracking::Configuration {
|
||||
ExampleConfiguration() { this = "ExampleConfiguration" }
|
||||
|
||||
override predicate isSource(DataFlow::Node source) {
|
||||
module TestConfig implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node source) {
|
||||
source.asExpr().(CallExpr).getCalleeName() = "SOURCE"
|
||||
}
|
||||
|
||||
override predicate isSink(DataFlow::Node sink) {
|
||||
predicate isSink(DataFlow::Node sink) {
|
||||
exists(CallExpr callExpr |
|
||||
callExpr.getCalleeName() = "SINK" and
|
||||
DataFlow::valueNode(callExpr.getArgument(0)) = sink
|
||||
@@ -15,6 +13,18 @@ class ExampleConfiguration extends TaintTracking::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
from ExampleConfiguration cfg, DataFlow::Node source, DataFlow::Node sink
|
||||
where cfg.hasFlow(source, sink)
|
||||
module TestFlow = TaintTracking::Global<TestConfig>;
|
||||
|
||||
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>
|
||||
|
||||
from DataFlow::Node source, DataFlow::Node sink
|
||||
where TestFlow::flow(source, sink)
|
||||
select sink
|
||||
|
||||
Reference in New Issue
Block a user