mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
C#: Re-factor the GlobalFlow test to use the new API.
This commit is contained in:
@@ -3,20 +3,18 @@
|
||||
*/
|
||||
|
||||
import csharp
|
||||
import DataFlow::PathGraph
|
||||
import GlobalFlow::PathGraph
|
||||
|
||||
class DataflowConfiguration extends DataFlow::Configuration {
|
||||
DataflowConfiguration() { this = "data flow configuration" }
|
||||
module GlobalFlowConfig implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node source) { source.asExpr().(Expr).getValue() = "tainted" }
|
||||
|
||||
override predicate isSource(DataFlow::Node source) {
|
||||
source.asExpr().(Expr).getValue() = "tainted"
|
||||
}
|
||||
|
||||
override predicate isSink(DataFlow::Node sink) {
|
||||
predicate isSink(DataFlow::Node sink) {
|
||||
exists(LocalVariable v | sink.asExpr() = v.getInitializer())
|
||||
}
|
||||
}
|
||||
|
||||
from DataFlow::PathNode source, DataFlow::PathNode sink, DataflowConfiguration conf
|
||||
where conf.hasFlowPath(source, sink)
|
||||
module GlobalFlow = DataFlow::Global<GlobalFlowConfig>;
|
||||
|
||||
from GlobalFlow::PathNode source, GlobalFlow::PathNode sink
|
||||
where GlobalFlow::flowPath(source, sink)
|
||||
select source, source, sink, "$@", sink, sink.toString()
|
||||
|
||||
Reference in New Issue
Block a user