mirror of
https://github.com/github/codeql.git
synced 2026-02-05 09:41:10 +01:00
29 lines
933 B
Plaintext
29 lines
933 B
Plaintext
import java
|
|
import semmle.code.java.dataflow.TaintTracking
|
|
import semmle.code.java.dataflow.FlowSources
|
|
import semmle.code.java.security.XPath
|
|
import TestUtilities.InlineExpectationsTest
|
|
|
|
module Config implements DataFlow::ConfigSig {
|
|
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
|
|
|
|
predicate isSink(DataFlow::Node sink) { sink instanceof XPathInjectionSink }
|
|
}
|
|
|
|
module Flow = TaintTracking::Global<Config>;
|
|
|
|
class HasXPathInjectionTest extends InlineExpectationsTest {
|
|
HasXPathInjectionTest() { this = "HasXPathInjectionTest" }
|
|
|
|
override string getARelevantTag() { result = "hasXPathInjection" }
|
|
|
|
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
|
tag = "hasXPathInjection" and
|
|
exists(DataFlow::Node sink | Flow::flowTo(sink) |
|
|
sink.getLocation() = location and
|
|
element = sink.toString() and
|
|
value = ""
|
|
)
|
|
}
|
|
}
|