-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathtest.ql
More file actions
35 lines (29 loc) · 1006 Bytes
/
test.ql
File metadata and controls
35 lines (29 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import python
import semmle.python.dataflow.new.DataFlow
import semmle.python.dataflow.new.TaintTracking
import utils.test.InlineExpectationsTest
private module TestConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node node) {
node.(DataFlow::CallCfgNode).getFunction().asCfgNode().(NameNode).getId() = "source"
}
predicate isSink(DataFlow::Node node) {
exists(DataFlow::CallCfgNode call |
call.getFunction().asCfgNode().(NameNode).getId() = "sink" and
node = call.getArg(0)
)
}
}
private module TestFlow = TaintTracking::Global<TestConfig>;
module FlowTest implements TestSig {
string getARelevantTag() { result = "prints" }
predicate hasActualResult(Location location, string element, string tag, string value) {
exists(DataFlow::Node sink |
TestFlow::flow(_, sink) and
tag = "prints" and
location = sink.getLocation() and
value = "source" and
element = sink.toString()
)
}
}
import MakeTest<FlowTest>