1313 * external/cwe/cwe-827
1414 */
1515
16- import codeql.ruby.AST
1716import codeql.ruby.dataflow.RemoteFlowSources
1817import codeql.ruby.TaintTracking
1918import codeql.ruby.Concepts
2019import codeql.ruby.DataFlow
21- import DataFlow:: PathGraph
2220
2321class UnsafeXxeSink extends DataFlow:: ExprNode {
2422 UnsafeXxeSink ( ) {
@@ -29,16 +27,18 @@ class UnsafeXxeSink extends DataFlow::ExprNode {
2927 }
3028}
3129
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 }
3432
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 }
3834}
3935
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 )
4242select sink .getNode ( ) , source , sink ,
4343 "XML parsing depends on a $@ without guarding against external entity expansion." ,
4444 source .getNode ( ) , "user-provided value"
0 commit comments