C#: Re-factor the EntityFramework test.

This commit is contained in:
Michael Nebel
2023-03-31 15:43:59 +02:00
parent 4023cd3b4c
commit 1f0fbfaef0

View File

@@ -3,18 +3,18 @@
*/ */
import csharp import csharp
import DataFlow::PathGraph import Taint::PathGraph
class MyConfiguration extends TaintTracking::Configuration { module TaintConfig implements DataFlow::ConfigSig {
MyConfiguration() { this = "EntityFramework dataflow" } predicate isSource(DataFlow::Node node) { node.asExpr().getValue() = "tainted" }
override predicate isSource(DataFlow::Node node) { node.asExpr().getValue() = "tainted" } predicate isSink(DataFlow::Node node) {
override predicate isSink(DataFlow::Node node) {
node.asExpr() = any(MethodCall c | c.getTarget().hasName("Sink")).getAnArgument() node.asExpr() = any(MethodCall c | c.getTarget().hasName("Sink")).getAnArgument()
} }
} }
from DataFlow::PathNode source, DataFlow::PathNode sink, MyConfiguration conf module Taint = TaintTracking::Global<TaintConfig>;
where conf.hasFlowPath(source, sink)
from Taint::PathNode source, Taint::PathNode sink
where Taint::flowPath(source, sink)
select sink, source, sink, "$@", source, source.toString() select sink, source, sink, "$@", source, source.toString()