Skip to content

Commit 44d99f8

Browse files
authored
*)update XQueryInjection.ql
1 parent ec4c155 commit 44d99f8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

java/ql/src/Security/CWE/CWE-652/XQueryInjection.ql

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,28 @@ import semmle.code.java.dataflow.FlowSources
1515
import XQueryInjectionLib
1616
import DataFlow::PathGraph
1717

18+
class XQueryInjectionConfig extends DataFlow::Configuration {
19+
XQueryInjectionConfig() { this = "XQueryInjectionConfig" }
20+
21+
override predicate isSource(DataFlow::Node source) { source instanceof XQueryInjectionSource }
22+
23+
override predicate isSink(DataFlow::Node sink) { sink instanceof XQueryInjectionSink }
24+
25+
override predicate isBarrier(DataFlow::Node node) {
26+
exists(MethodAccess ma, Method m, BindParameterRemoteFlowConf conf, DataFlow::Node node1 |
27+
m = ma.getMethod()
28+
|
29+
node.asExpr() = ma and
30+
m.hasName("bindString") and
31+
m.getDeclaringType()
32+
.getASourceSupertype*()
33+
.hasQualifiedName("javax.xml.xquery", "XQDynamicContext") and
34+
ma.getArgument(1) = node1.asExpr() and
35+
conf.hasFlowTo(node1)
36+
)
37+
}
38+
}
39+
1840
from DataFlow::PathNode source, DataFlow::PathNode sink, XQueryInjectionConfig conf
1941
where conf.hasFlowPath(source, sink)
2042
select sink.getNode(), source, sink, "XQuery query might include code from $@.", source.getNode(),

0 commit comments

Comments
 (0)