Skip to content

Commit 8517f11

Browse files
committed
C#: Re-factor the test case for ContentFlow.
1 parent 1b366fc commit 8517f11

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import csharp
2-
import semmle.code.csharp.dataflow.internal.ContentDataFlow
2+
import semmle.code.csharp.dataflow.internal.ContentDataFlow as ContentDataFlow
33

4-
class Conf extends ContentDataFlow::Configuration {
5-
Conf() { this = "ContentFlowConf" }
4+
module ContentConfig implements ContentDataFlow::ContentConfigSig {
5+
predicate isSource(DataFlow::Node src) { src.asExpr() instanceof ObjectCreation }
66

7-
override predicate isSource(DataFlow::Node src) { src.asExpr() instanceof ObjectCreation }
8-
9-
override predicate isSink(DataFlow::Node sink) {
7+
predicate isSink(DataFlow::Node sink) {
108
exists(MethodCall mc |
119
mc.getTarget().hasUndecoratedName("Sink") and
1210
mc.getAnArgument() = sink.asExpr()
1311
)
1412
}
1513

16-
override int accessPathLimit() { result = 2 }
14+
int accessPathLimit() { result = 2 }
1715
}
1816

17+
module ContentFlow = ContentDataFlow::Global<ContentConfig>;
18+
1919
from
20-
Conf conf, ContentDataFlow::Node source, ContentDataFlow::AccessPath sourceAp,
21-
ContentDataFlow::Node sink, ContentDataFlow::AccessPath sinkAp, boolean preservesValue
22-
where conf.hasFlow(source, sourceAp, sink, sinkAp, preservesValue)
20+
DataFlow::Node source, ContentFlow::AccessPath sourceAp, DataFlow::Node sink,
21+
ContentFlow::AccessPath sinkAp, boolean preservesValue
22+
where ContentFlow::flow(source, sourceAp, sink, sinkAp, preservesValue)
2323
select source, sourceAp, sink, sinkAp, preservesValue

0 commit comments

Comments
 (0)