Skip to content

Commit 103a6ea

Browse files
committed
JS: Port tutorial query5
1 parent 02c5e49 commit 103a6ea

File tree

1 file changed

+7
-7
lines changed
  • javascript/ql/test/tutorials/Analyzing data flow in JavaScript/Global data flow

1 file changed

+7
-7
lines changed

javascript/ql/test/tutorials/Analyzing data flow in JavaScript/Global data flow/query5.ql

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ class StepThroughResolveSymlinks extends TaintTracking::SharedTaintStep {
1010
}
1111
}
1212

13-
class CommandLineFileNameConfiguration extends TaintTracking::Configuration {
14-
CommandLineFileNameConfiguration() { this = "CommandLineFileNameConfiguration" }
15-
16-
override predicate isSource(DataFlow::Node source) {
13+
module CommandLineFileNameConfig implements DataFlow::ConfigSig {
14+
predicate isSource(DataFlow::Node source) {
1715
DataFlow::globalVarRef("process").getAPropertyRead("argv").getAPropertyRead() = source
1816
}
1917

20-
override predicate isSink(DataFlow::Node sink) {
18+
predicate isSink(DataFlow::Node sink) {
2119
DataFlow::moduleMember("fs", "readFile").getACall().getArgument(0) = sink
2220
}
2321
}
2422

25-
from CommandLineFileNameConfiguration cfg, DataFlow::Node source, DataFlow::Node sink
26-
where cfg.hasFlow(source, sink)
23+
module CommandLineFileNameFlow = TaintTracking::Global<CommandLineFileNameConfig>;
24+
25+
from DataFlow::Node source, DataFlow::Node sink
26+
where CommandLineFileNameFlow::flow(source, sink)
2727
select source, sink

0 commit comments

Comments
 (0)