Skip to content

Commit 9c60c4b

Browse files
committed
C#: Re-factor the JsonNet test.
1 parent 1f0fbfa commit 9c60c4b

File tree

1 file changed

+7
-9
lines changed
  • csharp/ql/test/library-tests/frameworks/JsonNET

1 file changed

+7
-9
lines changed
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import csharp
22

3-
class Configuration extends TaintTracking::Configuration {
4-
Configuration() { this = "Json.NET test" }
3+
module TaintConfig implements DataFlow::ConfigSig {
4+
predicate isSource(DataFlow::Node src) { src.asExpr().(StringLiteral).getValue() = "tainted" }
55

6-
override predicate isSource(DataFlow::Node src) {
7-
src.asExpr().(StringLiteral).getValue() = "tainted"
8-
}
9-
10-
override predicate isSink(DataFlow::Node sink) {
6+
predicate isSink(DataFlow::Node sink) {
117
exists(MethodCall c | c.getArgument(0) = sink.asExpr() and c.getTarget().getName() = "Sink")
128
}
139
}
1410

15-
from Configuration c, DataFlow::Node source, DataFlow::Node sink
16-
where c.hasFlow(source, sink)
11+
module Taint = TaintTracking::Global<TaintConfig>;
12+
13+
from DataFlow::Node source, DataFlow::Node sink
14+
where Taint::flow(source, sink)
1715
select source, sink

0 commit comments

Comments
 (0)