1
1
/** Provides default definitions to be used in XXE queries. */
2
2
3
3
import java
4
- private import semmle.code.java.dataflow.TaintTracking2
4
+ private import semmle.code.java.dataflow.TaintTracking
5
5
private import semmle.code.java.security.XmlParsers
6
6
import semmle.code.java.security.Xxe
7
7
@@ -11,7 +11,7 @@ import semmle.code.java.security.Xxe
11
11
*/
12
12
private class DefaultXxeSink extends XxeSink {
13
13
DefaultXxeSink ( ) {
14
- not exists ( SafeSaxSourceFlowConfig safeSource | safeSource . hasFlowTo ( this ) ) and
14
+ not SafeSaxSourceFlow :: flowTo ( this ) and
15
15
exists ( XmlParserCall parse |
16
16
parse .getSink ( ) = this .asExpr ( ) and
17
17
not parse .isSafe ( )
@@ -22,14 +22,12 @@ private class DefaultXxeSink extends XxeSink {
22
22
/**
23
23
* A taint-tracking configuration for safe XML readers used to parse XML documents.
24
24
*/
25
- private class SafeSaxSourceFlowConfig extends TaintTracking2 :: Configuration {
26
- SafeSaxSourceFlowConfig ( ) { this = "SafeSaxSourceFlowConfig" }
25
+ private module SafeSaxSourceFlowConfig implements DataFlow :: ConfigSig {
26
+ predicate isSource ( DataFlow :: Node src ) { src . asExpr ( ) instanceof SafeSaxSource }
27
27
28
- override predicate isSource ( DataFlow:: Node src ) { src .asExpr ( ) instanceof SafeSaxSource }
28
+ predicate isSink ( DataFlow:: Node sink ) { sink .asExpr ( ) = any ( XmlParserCall parse ) . getSink ( ) }
29
29
30
- override predicate isSink ( DataFlow:: Node sink ) {
31
- sink .asExpr ( ) = any ( XmlParserCall parse ) .getSink ( )
32
- }
33
-
34
- override int fieldFlowBranchLimit ( ) { result = 0 }
30
+ int fieldFlowBranchLimit ( ) { result = 0 }
35
31
}
32
+
33
+ private module SafeSaxSourceFlow = TaintTracking:: Global< SafeSaxSourceFlowConfig > ;
0 commit comments