mirror of
https://github.com/github/codeql.git
synced 2025-12-21 19:26:31 +01:00
C#: Re-factor the EntityFramework test.
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user