Skip to content

Commit 02c5e49

Browse files
committed
JS: Port tutorial query4
1 parent 1f6335f commit 02c5e49

File tree

1 file changed

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

1 file changed

+8
-8
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import javascript
22

3-
class CommandLineFileNameConfiguration extends TaintTracking::Configuration {
4-
CommandLineFileNameConfiguration() { this = "CommandLineFileNameConfiguration" }
5-
6-
override predicate isSource(DataFlow::Node source) {
3+
module CommandLineFileNameConfig implements DataFlow::ConfigSig {
4+
predicate isSource(DataFlow::Node source) {
75
DataFlow::globalVarRef("process").getAPropertyRead("argv").getAPropertyRead() = source
86
}
97

10-
override predicate isSink(DataFlow::Node sink) {
8+
predicate isSink(DataFlow::Node sink) {
119
DataFlow::moduleMember("fs", "readFile").getACall().getArgument(0) = sink
1210
}
1311

14-
override predicate isAdditionalTaintStep(DataFlow::Node pred, DataFlow::Node succ) {
12+
predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
1513
exists(DataFlow::CallNode c |
1614
c = DataFlow::moduleImport("resolve-symlinks").getACall() and
1715
pred = c.getArgument(0) and
@@ -20,6 +18,8 @@ class CommandLineFileNameConfiguration extends TaintTracking::Configuration {
2018
}
2119
}
2220

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

0 commit comments

Comments
 (0)