*)update XQueryInjection.ql

This commit is contained in:
haby0
2021-01-23 18:26:58 +08:00
committed by GitHub
parent ec4c155043
commit 44d99f8cd4

View File

@@ -15,6 +15,28 @@ import semmle.code.java.dataflow.FlowSources
import XQueryInjectionLib
import DataFlow::PathGraph
class XQueryInjectionConfig extends DataFlow::Configuration {
XQueryInjectionConfig() { this = "XQueryInjectionConfig" }
override predicate isSource(DataFlow::Node source) { source instanceof XQueryInjectionSource }
override predicate isSink(DataFlow::Node sink) { sink instanceof XQueryInjectionSink }
override predicate isBarrier(DataFlow::Node node) {
exists(MethodAccess ma, Method m, BindParameterRemoteFlowConf conf, DataFlow::Node node1 |
m = ma.getMethod()
|
node.asExpr() = ma and
m.hasName("bindString") and
m.getDeclaringType()
.getASourceSupertype*()
.hasQualifiedName("javax.xml.xquery", "XQDynamicContext") and
ma.getArgument(1) = node1.asExpr() and
conf.hasFlowTo(node1)
)
}
}
from DataFlow::PathNode source, DataFlow::PathNode sink, XQueryInjectionConfig conf
where conf.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "XQuery query might include code from $@.", source.getNode(),