-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathPartialPathsFromSink.ql
More file actions
44 lines (36 loc) · 1.37 KB
/
PartialPathsFromSink.ql
File metadata and controls
44 lines (36 loc) · 1.37 KB
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
36
37
38
39
40
41
42
43
44
/**
* @name Partial Path Query from Sink
* @kind path-problem
* @problem.severity warning
* @security-severity 1.0
* @sub-severity low
* @precision low
* @id py/debugging/partial-path-from-sink
* @tags debugging
*/
import python
import ghsl
import semmle.python.dataflow.new.DataFlow
import semmle.python.dataflow.new.TaintTracking
import semmle.python.Concepts
import semmle.python.dataflow.new.RemoteFlowSources
import semmle.python.dataflow.new.BarrierGuards
import semmle.python.ApiGraphs
// Partial Graph
module PartialFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { any() }
predicate isSink(DataFlow::Node sink) { sink instanceof AllSinks }
}
int explorationLimit() { result = 10 }
private module PartialFlows = DataFlow::Global<PartialFlowConfig>;
private module PartialFlowsGraph = PartialFlows::FlowExplorationRev<explorationLimit/0>;
private import PartialFlowsGraph::PartialPathGraph
from PartialFlowsGraph::PartialPathNode source, PartialFlowsGraph::PartialPathNode sink
where
/// Only show sinks from a certain file
// findByLocation(sink.getNode(), "File.java", _) and
/// Only show sources that match our criteria
// checkSource(source.getNode()) and
/// Partical Path
PartialFlowsGraph::partialFlow(source, sink, _)
select sink.getNode(), source, sink, "Partial Graph $@.", source.getNode(), "user-provided value"