Merge pull request #14983 from aschackmull/dataflow/deprecate-old-api

Data Flow: Deprecate old data flow api.
This commit is contained in:
Anders Schack-Mulligen
2023-12-08 14:27:25 +01:00
committed by GitHub
79 changed files with 785 additions and 738 deletions

View File

@@ -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>;

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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>;

View File

@@ -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

View File

@@ -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