13
13
* external/cwe/cwe-827
14
14
*/
15
15
16
- import codeql.ruby.AST
17
16
import codeql.ruby.dataflow.RemoteFlowSources
18
17
import codeql.ruby.TaintTracking
19
18
import codeql.ruby.Concepts
20
19
import codeql.ruby.DataFlow
21
- import DataFlow:: PathGraph
22
20
23
21
class UnsafeXxeSink extends DataFlow:: ExprNode {
24
22
UnsafeXxeSink ( ) {
@@ -29,16 +27,18 @@ class UnsafeXxeSink extends DataFlow::ExprNode {
29
27
}
30
28
}
31
29
32
- class XxeConfig extends TaintTracking :: Configuration {
33
- XxeConfig ( ) { this = "XXE.ql::XxeConfig" }
30
+ private module XxeConfig implements DataFlow :: ConfigSig {
31
+ predicate isSource ( DataFlow :: Node src ) { src instanceof RemoteFlowSource }
34
32
35
- override predicate isSource ( DataFlow:: Node src ) { src instanceof RemoteFlowSource }
36
-
37
- override predicate isSink ( DataFlow:: Node sink ) { sink instanceof UnsafeXxeSink }
33
+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof UnsafeXxeSink }
38
34
}
39
35
40
- from DataFlow:: PathNode source , DataFlow:: PathNode sink , XxeConfig conf
41
- where conf .hasFlowPath ( source , sink )
36
+ private module XxeFlow = TaintTracking:: Global< XxeConfig > ;
37
+
38
+ private import XxeFlow:: PathGraph
39
+
40
+ from XxeFlow:: PathNode source , XxeFlow:: PathNode sink
41
+ where XxeFlow:: flowPath ( source , sink )
42
42
select sink .getNode ( ) , source , sink ,
43
43
"XML parsing depends on a $@ without guarding against external entity expansion." ,
44
44
source .getNode ( ) , "user-provided value"
0 commit comments