mirror of
https://github.com/github/codeql.git
synced 2026-04-29 02:35:15 +02:00
Merge pull request #13346 from jketema/inline-2
Update inline expectation tests to use parameterized module
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -12,12 +12,10 @@ module Config implements DataFlow::ConfigSig {
|
||||
|
||||
module Flow = DataFlow::Global<Config>;
|
||||
|
||||
class HasFlowTest extends InlineExpectationsTest {
|
||||
HasFlowTest() { this = "HasFlowTest" }
|
||||
module HasFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "flow" }
|
||||
|
||||
override string getARelevantTag() { result = "flow" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "flow" and
|
||||
exists(DataFlow::Node src, DataFlow::Node sink | Flow::flow(src, sink) |
|
||||
sink.getLocation() = location and
|
||||
@@ -26,3 +24,5 @@ class HasFlowTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<HasFlowTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -18,12 +18,10 @@ module TaintFlowConfig implements DataFlow::ConfigSig {
|
||||
|
||||
module TaintFlow = TaintTracking::Global<TaintFlowConfig>;
|
||||
|
||||
class HasFlowTest extends InlineExpectationsTest {
|
||||
HasFlowTest() { this = "HasFlowTest" }
|
||||
module HasFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "hasTaintFlow" }
|
||||
|
||||
override string getARelevantTag() { result = ["hasTaintFlow"] }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "hasTaintFlow" and
|
||||
exists(DataFlow::Node sink | TaintFlow::flowTo(sink) |
|
||||
sink.getLocation() = location and
|
||||
@@ -32,3 +30,5 @@ class HasFlowTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<HasFlowTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -59,12 +59,10 @@ module Flow = TaintTracking::GlobalWithState<Config>;
|
||||
|
||||
module PartialFlow = Flow::FlowExploration<explorationLimit/0>;
|
||||
|
||||
class HasFlowTest extends InlineExpectationsTest {
|
||||
HasFlowTest() { this = "HasFlowTest" }
|
||||
module HasFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = ["pFwd", "pRev", "flow"] }
|
||||
|
||||
override string getARelevantTag() { result = ["pFwd", "pRev", "flow"] }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "flow" and
|
||||
exists(Flow::PathNode src, Flow::PathNode sink |
|
||||
Flow::flowPath(src, sink) and
|
||||
@@ -92,3 +90,5 @@ class HasFlowTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<HasFlowTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -26,12 +26,10 @@ module LocalTaintConfig implements DataFlow::ConfigSig {
|
||||
|
||||
module LocalTaintFlow = TaintTracking::Global<LocalTaintConfig>;
|
||||
|
||||
class LocalFlowTest extends InlineExpectationsTest {
|
||||
LocalFlowTest() { this = "LocalFlowTest" }
|
||||
module LocalFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = ["hasLocalValueFlow", "hasLocalTaintFlow"] }
|
||||
|
||||
override string getARelevantTag() { result = ["hasLocalValueFlow", "hasLocalTaintFlow"] }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "hasLocalValueFlow" and
|
||||
exists(DataFlow::Node sink | LocalValueFlow::flowTo(sink) |
|
||||
sink.getLocation() = location and
|
||||
@@ -49,3 +47,5 @@ class LocalFlowTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<LocalFlowTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -22,12 +22,10 @@ module RemoteTaintConfig implements DataFlow::ConfigSig {
|
||||
|
||||
module RemoteTaintFlow = TaintTracking::Global<RemoteTaintConfig>;
|
||||
|
||||
class RemoteFlowTest extends InlineExpectationsTest {
|
||||
RemoteFlowTest() { this = "RemoteFlowTest" }
|
||||
module RemoteFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = ["hasRemoteValueFlow", "hasRemoteTaintFlow"] }
|
||||
|
||||
override string getARelevantTag() { result = ["hasRemoteValueFlow", "hasRemoteTaintFlow"] }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "hasRemoteValueFlow" and
|
||||
exists(DataFlow::Node sink | RemoteValueFlow::flowTo(sink) |
|
||||
sink.getLocation() = location and
|
||||
@@ -45,3 +43,5 @@ class RemoteFlowTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<RemoteFlowTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -3,10 +3,8 @@ import semmle.code.java.frameworks.JaxWS
|
||||
import semmle.code.java.security.XSS
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class JaxRsTest extends InlineExpectationsTest {
|
||||
JaxRsTest() { this = "JaxRsTest" }
|
||||
|
||||
override string getARelevantTag() {
|
||||
module JaxRsTest implements TestSig {
|
||||
string getARelevantTag() {
|
||||
result =
|
||||
[
|
||||
"ResourceMethod", "RootResourceClass", "NonRootResourceClass",
|
||||
@@ -18,7 +16,7 @@ class JaxRsTest extends InlineExpectationsTest {
|
||||
]
|
||||
}
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "ResourceMethod" and
|
||||
exists(JaxRsResourceMethod resourceMethod |
|
||||
resourceMethod.getLocation() = location and
|
||||
@@ -168,3 +166,5 @@ class JaxRsTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<JaxRsTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -2,12 +2,10 @@ import java
|
||||
import semmle.code.java.frameworks.JaxWS
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class JaxWsEndpointTest extends InlineExpectationsTest {
|
||||
JaxWsEndpointTest() { this = "JaxWsEndpointTest" }
|
||||
module JaxWsEndpointTest implements TestSig {
|
||||
string getARelevantTag() { result = ["JaxWsEndpoint", "JaxWsEndpointRemoteMethod"] }
|
||||
|
||||
override string getARelevantTag() { result = ["JaxWsEndpoint", "JaxWsEndpointRemoteMethod"] }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "JaxWsEndpoint" and
|
||||
exists(JaxWsEndpoint jaxWsEndpoint |
|
||||
jaxWsEndpoint.getLocation() = location and
|
||||
@@ -25,3 +23,5 @@ class JaxWsEndpointTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<JaxWsEndpointTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -14,12 +14,10 @@ module Config implements DataFlow::ConfigSig {
|
||||
|
||||
module Flow = TaintTracking::Global<Config>;
|
||||
|
||||
class FlowStepTest extends InlineExpectationsTest {
|
||||
FlowStepTest() { this = "FlowStepTest" }
|
||||
module FlowStepTest implements TestSig {
|
||||
string getARelevantTag() { result = "taintReachesReturn" }
|
||||
|
||||
override string getARelevantTag() { result = "taintReachesReturn" }
|
||||
|
||||
override predicate hasActualResult(Location l, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location l, string element, string tag, string value) {
|
||||
tag = "taintReachesReturn" and
|
||||
value = "" and
|
||||
exists(DataFlow::Node source | Flow::flow(source, _) |
|
||||
@@ -28,3 +26,5 @@ class FlowStepTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<FlowStepTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -14,12 +14,10 @@ module Config implements DataFlow::ConfigSig {
|
||||
|
||||
module Flow = TaintTracking::Global<Config>;
|
||||
|
||||
class SinkTest extends InlineExpectationsTest {
|
||||
SinkTest() { this = "SinkTest" }
|
||||
module SinkTest implements TestSig {
|
||||
string getARelevantTag() { result = "taintReachesSink" }
|
||||
|
||||
override string getARelevantTag() { result = "taintReachesSink" }
|
||||
|
||||
override predicate hasActualResult(Location l, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location l, string element, string tag, string value) {
|
||||
tag = "taintReachesSink" and
|
||||
value = "" and
|
||||
exists(DataFlow::Node source | Flow::flow(source, _) |
|
||||
@@ -28,3 +26,5 @@ class SinkTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<SinkTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -24,12 +24,10 @@ module ValueFlowConfig implements DataFlow::ConfigSig {
|
||||
|
||||
module ValueFlow = DataFlow::Global<ValueFlowConfig>;
|
||||
|
||||
class HasFlowTest extends InlineExpectationsTest {
|
||||
HasFlowTest() { this = "HasFlowTest" }
|
||||
module HasFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = ["numTaintFlow", "numValueFlow"] }
|
||||
|
||||
override string getARelevantTag() { result = ["numTaintFlow", "numValueFlow"] }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "numTaintFlow" and
|
||||
exists(DataFlow::Node src, DataFlow::Node sink, int num | TaintFlow::flow(src, sink) |
|
||||
not ValueFlow::flow(src, sink) and
|
||||
@@ -48,3 +46,5 @@ class HasFlowTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<HasFlowTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -14,15 +14,15 @@ module TestConfig implements DataFlow::ConfigSig {
|
||||
|
||||
module TestFlow = TaintTracking::Global<TestConfig>;
|
||||
|
||||
class JmsFlowTest extends InlineExpectationsTest {
|
||||
JmsFlowTest() { this = "JmsFlowTest" }
|
||||
module JmsFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "tainted" }
|
||||
|
||||
override string getARelevantTag() { result = "tainted" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "tainted" and
|
||||
exists(TestFlow::PathNode sink | TestFlow::flowPath(_, sink) |
|
||||
location = sink.getNode().getLocation() and element = sink.getNode().toString() and value = ""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<JmsFlowTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -2,15 +2,15 @@ import java
|
||||
import semmle.code.java.dataflow.FlowSources
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class JmsRemoteSourcesTest extends InlineExpectationsTest {
|
||||
JmsRemoteSourcesTest() { this = "JmsRemoteSourcesTest" }
|
||||
module JmsRemoteSourcesTest implements TestSig {
|
||||
string getARelevantTag() { result = "source" }
|
||||
|
||||
override string getARelevantTag() { result = "source" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "source" and
|
||||
exists(RemoteFlowSource source |
|
||||
location = source.getLocation() and element = source.toString() and value = ""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<JmsRemoteSourcesTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -2,12 +2,10 @@ import java
|
||||
import semmle.code.java.dataflow.FlowSources
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class SourceTest extends InlineExpectationsTest {
|
||||
SourceTest() { this = "SourceTest" }
|
||||
module SourceTest implements TestSig {
|
||||
string getARelevantTag() { result = "source" }
|
||||
|
||||
override string getARelevantTag() { result = "source" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "source" and
|
||||
exists(RemoteFlowSource source |
|
||||
not source.asParameter().getCallable().getDeclaringType().hasName("DefaultConsumer") and
|
||||
@@ -17,3 +15,5 @@ class SourceTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<SourceTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -4,12 +4,10 @@ import semmle.code.java.dataflow.DataFlow
|
||||
import semmle.code.java.dataflow.ExternalFlow
|
||||
import semmle.code.java.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
|
||||
|
||||
class SinkTest extends InlineExpectationsTest {
|
||||
SinkTest() { this = "SinkTest" }
|
||||
module SinkTest implements TestSig {
|
||||
string getARelevantTag() { result = "isSink" }
|
||||
|
||||
override string getARelevantTag() { result = "isSink" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "isSink" and
|
||||
exists(DataFlow::Node sink |
|
||||
sinkNode(sink, _) and
|
||||
@@ -20,12 +18,10 @@ class SinkTest extends InlineExpectationsTest {
|
||||
}
|
||||
}
|
||||
|
||||
class NeutralSinkTest extends InlineExpectationsTest {
|
||||
NeutralSinkTest() { this = "NeutralSinkTest" }
|
||||
module NeutralSinkTest implements TestSig {
|
||||
string getARelevantTag() { result = "isNeutralSink" }
|
||||
|
||||
override string getARelevantTag() { result = "isNeutralSink" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "isNeutralSink" and
|
||||
exists(Call call, Callable callable |
|
||||
call.getCallee() = callable and
|
||||
@@ -38,3 +34,5 @@ class NeutralSinkTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<MergeTests<SinkTest, NeutralSinkTest>>
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
failures
|
||||
testFailures
|
||||
| test.xml:4:5:4:32 | attribute=value | Unexpected result: hasXmlResult= |
|
||||
| test.xml:5:29:5:52 | $ hasXmlResult | Missing result:hasXmlResult= |
|
||||
| test.xml:5:29:5:52 | $ hasXmlResult | Missing result:hasXmlResult= |
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import semmle.code.xml.XML
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class XmlTest extends InlineExpectationsTest {
|
||||
XmlTest() { this = "XmlTest" }
|
||||
module XmlTest implements TestSig {
|
||||
string getARelevantTag() { result = "hasXmlResult" }
|
||||
|
||||
override string getARelevantTag() { result = "hasXmlResult" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "hasXmlResult" and
|
||||
exists(XmlAttribute a |
|
||||
a.getLocation() = location and
|
||||
@@ -15,3 +13,5 @@ class XmlTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<XmlTest>
|
||||
|
||||
Reference in New Issue
Block a user