|
3 | 3 | */ |
4 | 4 |
|
5 | 5 | import csharp |
6 | | -import DataFlow |
| 6 | +import Flow::PathGraph |
7 | 7 |
|
8 | | -private predicate relevantPathNode(PathNode n) { |
| 8 | +private predicate relevantPathNode(Flow::PathNode n) { |
9 | 9 | exists(File f | f = n.getNode().getLocation().getFile() | |
10 | 10 | f.fromSource() |
11 | 11 | or |
12 | 12 | f.getBaseName() = "DataFlow.dll" |
13 | 13 | ) |
14 | 14 | } |
15 | 15 |
|
16 | | -query predicate edges(PathNode a, PathNode b) { |
17 | | - PathGraph::edges(a, b) and |
| 16 | +query predicate edges(Flow::PathNode a, Flow::PathNode b) { |
| 17 | + Flow::PathGraph::edges(a, b) and |
18 | 18 | relevantPathNode(a) and |
19 | 19 | relevantPathNode(b) |
20 | 20 | } |
21 | 21 |
|
22 | | -query predicate nodes(PathNode n, string key, string val) { |
23 | | - PathGraph::nodes(n, key, val) and |
| 22 | +query predicate nodes(Flow::PathNode n, string key, string val) { |
| 23 | + Flow::PathGraph::nodes(n, key, val) and |
24 | 24 | relevantPathNode(n) |
25 | 25 | } |
26 | 26 |
|
27 | | -query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) { |
28 | | - PathGraph::subpaths(arg, par, ret, out) and |
| 27 | +query predicate subpaths( |
| 28 | + Flow::PathNode arg, Flow::PathNode par, Flow::PathNode ret, Flow::PathNode out |
| 29 | +) { |
| 30 | + Flow::PathGraph::subpaths(arg, par, ret, out) and |
29 | 31 | relevantPathNode(arg) and |
30 | 32 | relevantPathNode(par) and |
31 | 33 | relevantPathNode(ret) and |
32 | 34 | relevantPathNode(out) |
33 | 35 | } |
34 | 36 |
|
35 | | -class FlowConfig extends Configuration { |
36 | | - FlowConfig() { this = "FlowConfig" } |
| 37 | +module FlowConfig implements DataFlow::ConfigSig { |
| 38 | + predicate isSource(DataFlow::Node source) { source.asExpr() instanceof Literal } |
37 | 39 |
|
38 | | - override predicate isSource(Node source) { source.asExpr() instanceof Literal } |
39 | | - |
40 | | - override predicate isSink(Node sink) { |
| 40 | + predicate isSink(DataFlow::Node sink) { |
41 | 41 | exists(LocalVariable decl | sink.asExpr() = decl.getInitializer()) |
42 | 42 | } |
43 | 43 | } |
44 | 44 |
|
45 | | -from PathNode source, PathNode sink, FlowConfig config |
46 | | -where config.hasFlowPath(source, sink) |
| 45 | +module Flow = DataFlow::Global<FlowConfig>; |
| 46 | + |
| 47 | +from Flow::PathNode source, Flow::PathNode sink |
| 48 | +where Flow::flowPath(source, sink) |
47 | 49 | select source, sink, sink, "$@", sink, sink.toString() |
0 commit comments