Skip to content

Commit f62bbf2

Browse files
authored
Merge pull request github#12980 from yoff/python/update-taint-debug
python: update debug queries
2 parents 6a33e87 + 9cc7cde commit f62bbf2

File tree

4 files changed

+34
-21
lines changed

4 files changed

+34
-21
lines changed

python/ql/test/experimental/dataflow/testConfig.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,4 @@ class TestConfiguration extends DataFlow::Configuration {
4646
}
4747

4848
override predicate isBarrierIn(DataFlow::Node node) { this.isSource(node) }
49-
50-
override int explorationLimit() { result = 5 }
5149
}

python/ql/test/experimental/dataflow/testTaintConfig.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,4 @@ class TestConfiguration extends TaintTracking::Configuration {
4646
}
4747

4848
override predicate isSanitizerIn(DataFlow::Node node) { this.isSource(node) }
49-
50-
override int explorationLimit() { result = 5 }
5149
}

python/ql/test/experimental/meta/debug/InlineTaintTestPaths.ql

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,27 @@
99
// 3. if necessary, look at partial paths by (un)commenting appropriate lines
1010
import python
1111
import semmle.python.dataflow.new.DataFlow
12+
import semmle.python.dataflow.new.TaintTracking
1213
import experimental.meta.InlineTaintTest::Conf
13-
// import DataFlow::PartialPathGraph
14-
import DataFlow::PathGraph
1514

16-
class Conf extends TestTaintTrackingConfiguration {
17-
// override int explorationLimit() { result = 5 }
15+
module Config implements DataFlow::ConfigSig {
16+
predicate isSource(DataFlow::Node source) {
17+
any(TestTaintTrackingConfiguration c).isSource(source)
18+
}
19+
20+
predicate isSink(DataFlow::Node source) { any(TestTaintTrackingConfiguration c).isSink(source) }
1821
}
1922

20-
// from Conf config, DataFlow::PartialPathNode source, DataFlow::PartialPathNode sink
21-
// where config.hasPartialFlow(source, sink, _)
22-
from Conf config, DataFlow::PathNode source, DataFlow::PathNode sink
23-
where config.hasFlowPath(source, sink)
23+
module Flows = TaintTracking::Global<Config>;
24+
25+
import Flows::PathGraph
26+
27+
// int explorationLimit() { result = 5 }
28+
// module FlowsPartial = Flows::FlowExploration<explorationLimit/0>;
29+
// import FlowsPartial::PartialPathGraph
30+
from Flows::PathNode source, Flows::PathNode sink
31+
where Flows::flowPath(source, sink)
32+
// from FlowsPartial::PartialPathNode source, FlowsPartial::PartialPathNode sink
33+
// where FlowsPartial::partialFlow(source, sink, _)
2434
select sink.getNode(), source, sink, "This node receives taint from $@.", source.getNode(),
2535
"this source"

python/ql/test/experimental/meta/debug/dataflowTestPaths.ql

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,23 @@
1010
import python
1111
import semmle.python.dataflow.new.DataFlow
1212
import experimental.dataflow.testConfig
13-
// import DataFlow::PartialPathGraph
14-
import DataFlow::PathGraph
1513

16-
class Conf extends TestConfiguration {
17-
override int explorationLimit() { result = 5 }
14+
module Config implements DataFlow::ConfigSig {
15+
predicate isSource(DataFlow::Node source) { any(TestConfiguration c).isSource(source) }
16+
17+
predicate isSink(DataFlow::Node source) { any(TestConfiguration c).isSink(source) }
1818
}
1919

20-
// from Conf config, DataFlow::PartialPathNode source, DataFlow::PartialPathNode sink
21-
// where config.hasPartialFlow(source, sink, _)
22-
from Conf config, DataFlow::PathNode source, DataFlow::PathNode sink
23-
where config.hasFlowPath(source, sink)
24-
select sink.getNode(), source, sink, "This node receives taint from $@.", source.getNode(),
20+
module Flows = DataFlow::Global<Config>;
21+
22+
import Flows::PathGraph
23+
24+
// int explorationLimit() { result = 5 }
25+
// module FlowsPartial = Flows::FlowExploration<explorationLimit/0>;
26+
// import FlowsPartial::PartialPathGraph
27+
from Flows::PathNode source, Flows::PathNode sink
28+
where Flows::flowPath(source, sink)
29+
// from FlowsPartial::PartialPathNode source, FlowsPartial::PartialPathNode sink
30+
// where FlowsPartial::partialFlow(source, sink, _)
31+
select sink.getNode(), source, sink, "This node receives flow from $@.", source.getNode(),
2532
"this source"

0 commit comments

Comments
 (0)