1
1
import csharp
2
2
import cil
3
- import semmle.code.csharp.dataflow.internal.DataFlowPrivate
4
- import semmle.code.csharp.dataflow.internal.DataFlowPublic
5
- import semmle.code.csharp.dataflow.internal.DataFlowDispatch
6
- import semmle.code.csharp.dataflow.internal.DataFlowImplConsistency:: Consistency
3
+ private import semmle.code.csharp.dataflow.internal.DataFlowImplSpecific
4
+ private import semmle.code.csharp.dataflow.internal.TaintTrackingImplSpecific
5
+ private import codeql.dataflow.internal.DataFlowImplConsistency
7
6
8
- private class MyConsistencyConfiguration extends ConsistencyConfiguration {
9
- override predicate uniqueEnclosingCallableExclude ( Node n ) {
7
+ private module Input implements InputSig< CsharpDataFlow > {
8
+ private import CsharpDataFlow
9
+
10
+ predicate uniqueEnclosingCallableExclude ( Node n ) {
10
11
// TODO: Remove once static initializers are folded into the
11
12
// static constructors
12
13
exists ( ControlFlow:: Node cfn |
@@ -15,7 +16,7 @@ private class MyConsistencyConfiguration extends ConsistencyConfiguration {
15
16
)
16
17
}
17
18
18
- override predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) {
19
+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) {
19
20
// TODO: Remove once static initializers are folded into the
20
21
// static constructors
21
22
exists ( ControlFlow:: Node cfn |
@@ -24,25 +25,25 @@ private class MyConsistencyConfiguration extends ConsistencyConfiguration {
24
25
)
25
26
}
26
27
27
- override predicate uniqueNodeLocationExclude ( Node n ) {
28
+ predicate uniqueNodeLocationExclude ( Node n ) {
28
29
// Methods with multiple implementations
29
30
n instanceof ParameterNode
30
31
or
31
- this . missingLocationExclude ( n )
32
+ missingLocationExclude ( n )
32
33
}
33
34
34
- override predicate missingLocationExclude ( Node n ) {
35
+ predicate missingLocationExclude ( Node n ) {
35
36
// Some CIL methods are missing locations
36
37
n .asParameter ( ) instanceof CIL:: Parameter
37
38
}
38
39
39
- override predicate postWithInFlowExclude ( Node n ) {
40
+ predicate postWithInFlowExclude ( Node n ) {
40
41
n instanceof FlowSummaryNode
41
42
or
42
43
n .asExpr ( ) .( ObjectCreation ) .hasInitializer ( )
43
44
}
44
45
45
- override predicate argHasPostUpdateExclude ( ArgumentNode n ) {
46
+ predicate argHasPostUpdateExclude ( ArgumentNode n ) {
46
47
n instanceof FlowSummaryNode
47
48
or
48
49
not exists ( LocalFlow:: getAPostUpdateNodeForArg ( n .getControlFlowNode ( ) ) )
@@ -54,28 +55,28 @@ private class MyConsistencyConfiguration extends ConsistencyConfiguration {
54
55
n .asExpr ( ) instanceof CIL:: Expr
55
56
}
56
57
57
- override predicate postHasUniquePreExclude ( PostUpdateNode n ) {
58
+ predicate postHasUniquePreExclude ( PostUpdateNode n ) {
58
59
exists ( ControlFlow:: Nodes:: ExprNode e , ControlFlow:: Nodes:: ExprNode arg |
59
60
e = LocalFlow:: getAPostUpdateNodeForArg ( arg ) and
60
61
e != arg and
61
62
n = TExprPostUpdateNode ( e )
62
63
)
63
64
}
64
65
65
- override predicate uniquePostUpdateExclude ( Node n ) {
66
+ predicate uniquePostUpdateExclude ( Node n ) {
66
67
exists ( ControlFlow:: Nodes:: ExprNode e , ControlFlow:: Nodes:: ExprNode arg |
67
68
e = LocalFlow:: getAPostUpdateNodeForArg ( arg ) and
68
69
e != arg and
69
70
n .asExpr ( ) = arg .getExpr ( )
70
71
)
71
72
}
72
73
73
- override predicate reverseReadExclude ( Node n ) { n .asExpr ( ) = any ( AwaitExpr ae ) .getExpr ( ) }
74
-
75
- override predicate identityLocalStepExclude ( Node n ) { none ( ) }
74
+ predicate reverseReadExclude ( Node n ) { n .asExpr ( ) = any ( AwaitExpr ae ) .getExpr ( ) }
76
75
}
77
76
78
- query predicate multipleToString ( Node n , string s ) {
77
+ import MakeConsistency< CsharpDataFlow , CsharpTaintTracking , Input >
78
+
79
+ query predicate multipleToString ( DataFlow:: Node n , string s ) {
79
80
s = strictconcat ( n .toString ( ) , "," ) and
80
81
strictcount ( n .toString ( ) ) > 1
81
82
}
0 commit comments