|
1 | 1 | import csharp
|
2 |
| -import semmle.code.csharp.dataflow.internal.ContentDataFlow |
| 2 | +import semmle.code.csharp.dataflow.internal.ContentDataFlow as ContentDataFlow |
3 | 3 |
|
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 } |
6 | 6 |
|
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) { |
10 | 8 | exists(MethodCall mc |
|
11 | 9 | mc.getTarget().hasUndecoratedName("Sink") and
|
12 | 10 | mc.getAnArgument() = sink.asExpr()
|
13 | 11 | )
|
14 | 12 | }
|
15 | 13 |
|
16 |
| - override int accessPathLimit() { result = 2 } |
| 14 | + int accessPathLimit() { result = 2 } |
17 | 15 | }
|
18 | 16 |
|
| 17 | +module ContentFlow = ContentDataFlow::Global<ContentConfig>; |
| 18 | + |
19 | 19 | 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) |
23 | 23 | select source, sourceAp, sink, sinkAp, preservesValue
|
0 commit comments