Skip to content

Commit eaddb62

Browse files
committed
C#: Re-factor the GlobalFlow test to use the new API.
1 parent 73ddc05 commit eaddb62

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

csharp/ql/test/library-tests/csharp7/GlobalFlow.ql

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,18 @@
33
*/
44

55
import csharp
6-
import DataFlow::PathGraph
6+
import GlobalFlow::PathGraph
77

8-
class DataflowConfiguration extends DataFlow::Configuration {
9-
DataflowConfiguration() { this = "data flow configuration" }
8+
module GlobalFlowConfig implements DataFlow::ConfigSig {
9+
predicate isSource(DataFlow::Node source) { source.asExpr().(Expr).getValue() = "tainted" }
1010

11-
override predicate isSource(DataFlow::Node source) {
12-
source.asExpr().(Expr).getValue() = "tainted"
13-
}
14-
15-
override predicate isSink(DataFlow::Node sink) {
11+
predicate isSink(DataFlow::Node sink) {
1612
exists(LocalVariable v | sink.asExpr() = v.getInitializer())
1713
}
1814
}
1915

20-
from DataFlow::PathNode source, DataFlow::PathNode sink, DataflowConfiguration conf
21-
where conf.hasFlowPath(source, sink)
16+
module GlobalFlow = DataFlow::Global<GlobalFlowConfig>;
17+
18+
from GlobalFlow::PathNode source, GlobalFlow::PathNode sink
19+
where GlobalFlow::flowPath(source, sink)
2220
select source, source, sink, "$@", sink, sink.toString()

0 commit comments

Comments
 (0)