C#: Re-factor the Async test.

This commit is contained in:
Michael Nebel
2023-03-31 13:30:23 +02:00
parent a98cf0ae45
commit bd886202f6

View File

@@ -1,5 +1,5 @@
import csharp
import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
import Taint::PathGraph
class MySink extends DataFlow::ExprNode {
MySink() {
@@ -19,15 +19,15 @@ class MySource extends DataFlow::ParameterNode {
}
}
class MyConfig extends TaintTracking::Configuration {
MyConfig() { this = "MyConfig" }
module TaintConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof MySource }
override predicate isSource(DataFlow::Node source) { source instanceof MySource }
override predicate isSink(DataFlow::Node sink) { sink instanceof MySink }
predicate isSink(DataFlow::Node sink) { sink instanceof MySink }
}
from MyConfig c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
module Taint = TaintTracking::Global<TaintConfig>;
from Taint::PathNode source, Taint::PathNode sink
where Taint::flowPath(source, sink)
select sink.getNode(), source, sink, "$@ flows to here and is used.", source.getNode(),
"User-provided value"