C#: Re-factor the NHibernate test.

This commit is contained in:
Michael Nebel
2023-03-31 15:51:15 +02:00
parent 9c60c4b3d9
commit f00c97810a

View File

@@ -1,17 +1,15 @@
import csharp
class MyConfiguration extends TaintTracking::Configuration {
MyConfiguration() { this = "MyConfiguration" }
module TaintConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node node) { node.asExpr().(StringLiteral).getValue() = "tainted" }
override predicate isSource(DataFlow::Node node) {
node.asExpr().(StringLiteral).getValue() = "tainted"
}
override predicate isSink(DataFlow::Node node) {
predicate isSink(DataFlow::Node node) {
exists(MethodCall mc | mc.getTarget().hasName("Sink") and node.asExpr() = mc.getArgument(0))
}
}
from MyConfiguration config, DataFlow::Node source, DataFlow::Node sink
where config.hasFlow(source, sink)
module Taint = TaintTracking::Global<TaintConfig>;
from DataFlow::Node source, DataFlow::Node sink
where Taint::flow(source, sink)
select sink, "Data flow from $@.", source, source.toString()