mirror of
https://github.com/github/codeql.git
synced 2026-04-25 00:35:20 +02:00
Merge pull request #14983 from aschackmull/dataflow/deprecate-old-api
Data Flow: Deprecate old data flow api.
This commit is contained in:
@@ -4,10 +4,10 @@ import semmle.python.dataflow.new.DataFlow
|
||||
* A configuration to find all flows.
|
||||
* To be used on tiny programs.
|
||||
*/
|
||||
class AllFlowsConfig extends DataFlow::Configuration {
|
||||
AllFlowsConfig() { this = "AllFlowsConfig" }
|
||||
module AllFlowsConfig implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node node) { any() }
|
||||
|
||||
override predicate isSource(DataFlow::Node node) { any() }
|
||||
|
||||
override predicate isSink(DataFlow::Node node) { any() }
|
||||
predicate isSink(DataFlow::Node node) { any() }
|
||||
}
|
||||
|
||||
module AllFlowsFlow = DataFlow::Global<AllFlowsConfig>;
|
||||
|
||||
@@ -2,7 +2,7 @@ import experimental.dataflow.callGraphConfig
|
||||
|
||||
from DataFlow::Node source, DataFlow::Node sink
|
||||
where
|
||||
exists(CallGraphConfig cfg | cfg.hasFlow(source, sink)) and
|
||||
CallGraphFlow::flow(source, sink) and
|
||||
exists(source.getLocation().getFile().getRelativePath()) and
|
||||
exists(sink.getLocation().getFile().getRelativePath())
|
||||
select source, sink
|
||||
|
||||
@@ -2,6 +2,6 @@ import experimental.dataflow.callGraphConfig
|
||||
|
||||
from DataFlow::Node sink
|
||||
where
|
||||
exists(CallGraphConfig cfg | cfg.isSink(sink)) and
|
||||
CallGraphConfig::isSink(sink) and
|
||||
exists(sink.getLocation().getFile().getRelativePath())
|
||||
select sink
|
||||
|
||||
@@ -2,6 +2,6 @@ import experimental.dataflow.callGraphConfig
|
||||
|
||||
from DataFlow::Node source
|
||||
where
|
||||
exists(CallGraphConfig cfg | cfg.isSource(source)) and
|
||||
CallGraphConfig::isSource(source) and
|
||||
exists(source.getLocation().getFile().getRelativePath())
|
||||
select source
|
||||
|
||||
@@ -3,7 +3,7 @@ import allFlowsConfig
|
||||
from DataFlow::Node source, DataFlow::Node sink
|
||||
where
|
||||
source != sink and
|
||||
exists(AllFlowsConfig cfg | cfg.hasFlow(source, sink)) and
|
||||
AllFlowsFlow::flow(source, sink) and
|
||||
exists(source.getLocation().getFile().getRelativePath()) and
|
||||
exists(sink.getLocation().getFile().getRelativePath())
|
||||
select source, sink
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import allFlowsConfig
|
||||
|
||||
from DataFlow::PathNode fromNode, DataFlow::PathNode toNode
|
||||
from AllFlowsFlow::PathNode fromNode, AllFlowsFlow::PathNode toNode
|
||||
where
|
||||
toNode = fromNode.getASuccessor() and
|
||||
exists(fromNode.getNode().getLocation().getFile().getRelativePath()) and
|
||||
|
||||
@@ -3,7 +3,7 @@ import maximalFlowsConfig
|
||||
from DataFlow::Node source, DataFlow::Node sink
|
||||
where
|
||||
source != sink and
|
||||
exists(MaximalFlowsConfig cfg | cfg.hasFlow(source, sink)) and
|
||||
MaximalFlowsFlow::flow(source, sink) and
|
||||
exists(source.getLocation().getFile().getRelativePath()) and
|
||||
exists(sink.getLocation().getFile().getRelativePath())
|
||||
select source, sink
|
||||
|
||||
@@ -6,18 +6,18 @@ private import semmle.python.dataflow.new.internal.DataFlowPrivate as DataFlowPr
|
||||
* A configuration to find all "maximal" flows.
|
||||
* To be used on small programs.
|
||||
*/
|
||||
class MaximalFlowsConfig extends DataFlow::Configuration {
|
||||
MaximalFlowsConfig() { this = "AllFlowsConfig" }
|
||||
|
||||
override predicate isSource(DataFlow::Node node) {
|
||||
module MaximalFlowsConfig implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node node) {
|
||||
node instanceof DataFlow::ParameterNode
|
||||
or
|
||||
node instanceof DataFlow::LocalSourceNode
|
||||
}
|
||||
|
||||
override predicate isSink(DataFlow::Node node) {
|
||||
predicate isSink(DataFlow::Node node) {
|
||||
node instanceof DataFlowPrivate::ReturnNode
|
||||
or
|
||||
not DataFlowPrivate::LocalFlow::localFlowStep(node, _)
|
||||
}
|
||||
}
|
||||
|
||||
module MaximalFlowsFlow = DataFlow::Global<MaximalFlowsConfig>;
|
||||
|
||||
@@ -2,6 +2,6 @@ import allFlowsConfig
|
||||
|
||||
from DataFlow::Node sink
|
||||
where
|
||||
exists(AllFlowsConfig cfg | cfg.isSink(sink)) and
|
||||
AllFlowsConfig::isSink(sink) and
|
||||
exists(sink.getLocation().getFile().getRelativePath())
|
||||
select sink
|
||||
|
||||
@@ -2,6 +2,6 @@ import allFlowsConfig
|
||||
|
||||
from DataFlow::Node source
|
||||
where
|
||||
exists(AllFlowsConfig cfg | cfg.isSource(source)) and
|
||||
AllFlowsConfig::isSource(source) and
|
||||
exists(source.getLocation().getFile().getRelativePath())
|
||||
select source
|
||||
|
||||
Reference in New Issue
Block a user