Merge pull request #13346 from jketema/inline-2

Update inline expectation tests to use parameterized module
This commit is contained in:
Jeroen Ketema
2023-06-13 10:10:55 +02:00
committed by GitHub
244 changed files with 879 additions and 663 deletions

View File

@@ -19,12 +19,10 @@ module Config implements DataFlow::ConfigSig {
module Flow = TaintTracking::Global<Config>;
class InlineFlowTest extends InlineExpectationsTest {
InlineFlowTest() { this = "HasFlowTest" }
module InlineFlowTest 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 sink | Flow::flowTo(sink) |
sink.getLocation() = location and
@@ -33,3 +31,5 @@ class InlineFlowTest extends InlineExpectationsTest {
)
}
}
import MakeTest<InlineFlowTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -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>

View File

@@ -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>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -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>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -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>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -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>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -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>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -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>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -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>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -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>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -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>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -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>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -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>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -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>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -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>>

View File

@@ -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= |

View File

@@ -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>

View File

@@ -8,12 +8,10 @@ class TestRemoteSource extends RemoteFlowSource {
override string getSourceType() { result = "TestSource" }
}
class Test extends InlineExpectationsTest {
Test() { this = "PartialPathTraversalFromRemoteTest" }
module Test 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 | PartialPathTraversalFromRemoteFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -22,3 +20,5 @@ class Test extends InlineExpectationsTest {
)
}
}
import MakeTest<Test>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.JndiInjectionQuery
import TestUtilities.InlineExpectationsTest
class HasJndiInjectionTest extends InlineExpectationsTest {
HasJndiInjectionTest() { this = "HasJndiInjectionTest" }
module HasJndiInjectionTest implements TestSig {
string getARelevantTag() { result = "hasJndiInjection" }
override string getARelevantTag() { result = "hasJndiInjection" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasJndiInjection" and
exists(DataFlow::Node sink | JndiInjectionFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -16,3 +14,5 @@ class HasJndiInjectionTest extends InlineExpectationsTest {
)
}
}
import MakeTest<HasJndiInjectionTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -4,12 +4,10 @@ import semmle.code.java.dataflow.FlowSources
import semmle.code.java.security.XsltInjectionQuery
import TestUtilities.InlineExpectationsTest
class HasXsltInjectionTest extends InlineExpectationsTest {
HasXsltInjectionTest() { this = "HasXsltInjectionTest" }
module HasXsltInjectionTest implements TestSig {
string getARelevantTag() { result = "hasXsltInjection" }
override string getARelevantTag() { result = "hasXsltInjection" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasXsltInjection" and
exists(DataFlow::Node sink | XsltInjectionFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -18,3 +16,5 @@ class HasXsltInjectionTest extends InlineExpectationsTest {
)
}
}
import MakeTest<HasXsltInjectionTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.XssQuery
import TestUtilities.InlineExpectationsTest
class XssTest extends InlineExpectationsTest {
XssTest() { this = "XssTest" }
module XssTest implements TestSig {
string getARelevantTag() { result = "xss" }
override string getARelevantTag() { result = "xss" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "xss" and
exists(DataFlow::Node sink | XssFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -16,3 +14,5 @@ class XssTest extends InlineExpectationsTest {
)
}
}
import MakeTest<XssTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -9,12 +9,10 @@ private class SourceMethodSource extends RemoteFlowSource {
override string getSourceType() { result = "source" }
}
class HasFlowTest extends InlineExpectationsTest {
HasFlowTest() { this = "HasFlowTest" }
module HasFlowTest implements TestSig {
string getARelevantTag() { result = "sqlInjection" }
override string getARelevantTag() { result = "sqlInjection" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "sqlInjection" and
exists(DataFlow::Node sink | QueryInjectionFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -23,3 +21,5 @@ class HasFlowTest extends InlineExpectationsTest {
)
}
}
import MakeTest<HasFlowTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -3,12 +3,10 @@ import semmle.code.java.dataflow.DataFlow
import semmle.code.java.security.ArbitraryApkInstallationQuery
import TestUtilities.InlineExpectationsTest
class HasApkInstallationTest extends InlineExpectationsTest {
HasApkInstallationTest() { this = "HasApkInstallationTest" }
module HasApkInstallationTest implements TestSig {
string getARelevantTag() { result = "hasApkInstallation" }
override string getARelevantTag() { result = "hasApkInstallation" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasApkInstallation" and
exists(DataFlow::Node sink | ApkInstallationFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -17,3 +15,5 @@ class HasApkInstallationTest extends InlineExpectationsTest {
)
}
}
import MakeTest<HasApkInstallationTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -4,12 +4,10 @@ import semmle.code.java.dataflow.FlowSources
import semmle.code.java.security.GroovyInjectionQuery
import TestUtilities.InlineExpectationsTest
class HasGroovyInjectionTest extends InlineExpectationsTest {
HasGroovyInjectionTest() { this = "HasGroovyInjectionTest" }
module HasGroovyInjectionTest implements TestSig {
string getARelevantTag() { result = "hasGroovyInjection" }
override string getARelevantTag() { result = "hasGroovyInjection" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasGroovyInjection" and
exists(DataFlow::Node sink | GroovyInjectionFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -18,3 +16,5 @@ class HasGroovyInjectionTest extends InlineExpectationsTest {
)
}
}
import MakeTest<HasGroovyInjectionTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.JexlInjectionQuery
import TestUtilities.InlineExpectationsTest
class JexlInjectionTest extends InlineExpectationsTest {
JexlInjectionTest() { this = "HasJexlInjectionTest" }
module JexlInjectionTest implements TestSig {
string getARelevantTag() { result = "hasJexlInjection" }
override string getARelevantTag() { result = "hasJexlInjection" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasJexlInjection" and
exists(DataFlow::Node sink | JexlInjectionFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -16,3 +14,5 @@ class JexlInjectionTest extends InlineExpectationsTest {
)
}
}
import MakeTest<JexlInjectionTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -4,12 +4,10 @@ import semmle.code.java.dataflow.FlowSources
import semmle.code.java.security.MvelInjectionQuery
import TestUtilities.InlineExpectationsTest
class HasMvelInjectionTest extends InlineExpectationsTest {
HasMvelInjectionTest() { this = "HasMvelInjectionTest" }
module HasMvelInjectionTest implements TestSig {
string getARelevantTag() { result = "hasMvelInjection" }
override string getARelevantTag() { result = "hasMvelInjection" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasMvelInjection" and
exists(DataFlow::Node sink | MvelInjectionFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -18,3 +16,5 @@ class HasMvelInjectionTest extends InlineExpectationsTest {
)
}
}
import MakeTest<HasMvelInjectionTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -4,12 +4,10 @@ import semmle.code.java.dataflow.FlowSources
import semmle.code.java.security.SpelInjectionQuery
import TestUtilities.InlineExpectationsTest
class HasSpelInjectionTest extends InlineExpectationsTest {
HasSpelInjectionTest() { this = "HasSpelInjectionTest" }
module HasSpelInjectionTest implements TestSig {
string getARelevantTag() { result = "hasSpelInjection" }
override string getARelevantTag() { result = "hasSpelInjection" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasSpelInjection" and
exists(DataFlow::Node sink | SpelInjectionFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -18,3 +16,5 @@ class HasSpelInjectionTest extends InlineExpectationsTest {
)
}
}
import MakeTest<HasSpelInjectionTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.TemplateInjectionQuery
import TestUtilities.InlineExpectationsTest
class TemplateInjectionTest extends InlineExpectationsTest {
TemplateInjectionTest() { this = "TemplateInjectionTest" }
module TemplateInjectionTest implements TestSig {
string getARelevantTag() { result = "hasTemplateInjection" }
override string getARelevantTag() { result = "hasTemplateInjection" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasTemplateInjection" and
exists(DataFlow::Node sink | TemplateInjectionFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -16,3 +14,5 @@ class TemplateInjectionTest extends InlineExpectationsTest {
)
}
}
import MakeTest<TemplateInjectionTest>

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.StaticInitializationVectorQuery
import TestUtilities.InlineExpectationsTest
class StaticInitializationVectorTest extends InlineExpectationsTest {
StaticInitializationVectorTest() { this = "StaticInitializationVectorTest" }
module StaticInitializationVectorTest implements TestSig {
string getARelevantTag() { result = "staticInitializationVector" }
override string getARelevantTag() { result = "staticInitializationVector" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "staticInitializationVector" and
exists(DataFlow::Node sink | StaticInitializationVectorFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -16,3 +14,5 @@ class StaticInitializationVectorTest extends InlineExpectationsTest {
)
}
}
import MakeTest<StaticInitializationVectorTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.UnsafeCertTrustQuery
import TestUtilities.InlineExpectationsTest
class UnsafeCertTrustTest extends InlineExpectationsTest {
UnsafeCertTrustTest() { this = "HasUnsafeCertTrustTest" }
module UnsafeCertTrustTest implements TestSig {
string getARelevantTag() { result = "hasUnsafeCertTrust" }
override string getARelevantTag() { result = "hasUnsafeCertTrust" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasUnsafeCertTrust" and
exists(Expr unsafeTrust |
unsafeTrust instanceof RabbitMQEnableHostnameVerificationNotSet
@@ -20,3 +18,5 @@ class UnsafeCertTrustTest extends InlineExpectationsTest {
)
}
}
import MakeTest<UnsafeCertTrustTest>

View File

@@ -2,12 +2,10 @@ import java
import TestUtilities.InlineExpectationsTest
import semmle.code.java.security.AndroidCertificatePinningQuery
class Test extends InlineExpectationsTest {
Test() { this = "AndroidMissingCertificatePinningTest" }
module Test implements TestSig {
string getARelevantTag() { result = ["hasNoTrustedResult", "hasUntrustedResult"] }
override string getARelevantTag() { result = ["hasNoTrustedResult", "hasUntrustedResult"] }
override predicate hasActualResult(Location loc, string el, string tag, string value) {
predicate hasActualResult(Location loc, string el, string tag, string value) {
exists(DataFlow::Node node |
missingPinning(node, _) and
loc = node.getLocation() and
@@ -17,3 +15,5 @@ class Test extends InlineExpectationsTest {
)
}
}
import MakeTest<Test>

View File

@@ -2,12 +2,10 @@ import java
import TestUtilities.InlineExpectationsTest
import semmle.code.java.security.AndroidCertificatePinningQuery
class Test extends InlineExpectationsTest {
Test() { this = "AndroidMissingCertificatePinningTest" }
module Test implements TestSig {
string getARelevantTag() { result = ["hasNoTrustedResult", "hasUntrustedResult"] }
override string getARelevantTag() { result = ["hasNoTrustedResult", "hasUntrustedResult"] }
override predicate hasActualResult(Location loc, string el, string tag, string value) {
predicate hasActualResult(Location loc, string el, string tag, string value) {
exists(DataFlow::Node node |
missingPinning(node, _) and
loc = node.getLocation() and
@@ -17,3 +15,5 @@ class Test extends InlineExpectationsTest {
)
}
}
import MakeTest<Test>

View File

@@ -2,12 +2,10 @@ import java
import TestUtilities.InlineExpectationsTest
import semmle.code.java.security.AndroidCertificatePinningQuery
class Test extends InlineExpectationsTest {
Test() { this = "AndroidMissingCertificatePinningTest" }
module Test implements TestSig {
string getARelevantTag() { result = ["hasNoTrustedResult", "hasUntrustedResult"] }
override string getARelevantTag() { result = ["hasNoTrustedResult", "hasUntrustedResult"] }
override predicate hasActualResult(Location loc, string el, string tag, string value) {
predicate hasActualResult(Location loc, string el, string tag, string value) {
exists(DataFlow::Node node |
missingPinning(node, _) and
loc = node.getLocation() and
@@ -17,3 +15,5 @@ class Test extends InlineExpectationsTest {
)
}
}
import MakeTest<Test>

View File

@@ -2,12 +2,10 @@ import java
import TestUtilities.InlineExpectationsTest
import semmle.code.java.security.AndroidCertificatePinningQuery
class Test extends InlineExpectationsTest {
Test() { this = "AndroidMissingCertificatePinningTest" }
module Test implements TestSig {
string getARelevantTag() { result = ["hasNoTrustedResult", "hasUntrustedResult"] }
override string getARelevantTag() { result = ["hasNoTrustedResult", "hasUntrustedResult"] }
override predicate hasActualResult(Location loc, string el, string tag, string value) {
predicate hasActualResult(Location loc, string el, string tag, string value) {
exists(DataFlow::Node node |
missingPinning(node, _) and
loc = node.getLocation() and
@@ -17,3 +15,5 @@ class Test extends InlineExpectationsTest {
)
}
}
import MakeTest<Test>

View File

@@ -2,12 +2,10 @@ import java
import TestUtilities.InlineExpectationsTest
import semmle.code.java.security.AndroidCertificatePinningQuery
class Test extends InlineExpectationsTest {
Test() { this = "AndroidMissingCertificatePinningTest" }
module Test implements TestSig {
string getARelevantTag() { result = ["hasNoTrustedResult", "hasUntrustedResult"] }
override string getARelevantTag() { result = ["hasNoTrustedResult", "hasUntrustedResult"] }
override predicate hasActualResult(Location loc, string el, string tag, string value) {
predicate hasActualResult(Location loc, string el, string tag, string value) {
exists(DataFlow::Node node |
missingPinning(node, _) and
loc = node.getLocation() and
@@ -17,3 +15,5 @@ class Test extends InlineExpectationsTest {
)
}
}
import MakeTest<Test>

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.AndroidWebViewCertificateValidationQuery
import TestUtilities.InlineExpectationsTest
class WebViewTest extends InlineExpectationsTest {
WebViewTest() { this = "WebViewTest" }
module WebViewTest implements TestSig {
string getARelevantTag() { result = "hasResult" }
override string getARelevantTag() { result = "hasResult" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
exists(OnReceivedSslErrorMethod m |
trustsAllCerts(m) and
location = m.getLocation() and
@@ -17,3 +15,5 @@ class WebViewTest extends InlineExpectationsTest {
)
}
}
import MakeTest<WebViewTest>

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.InsecureTrustManagerQuery
import TestUtilities.InlineExpectationsTest
class InsecureTrustManagerTest extends InlineExpectationsTest {
InsecureTrustManagerTest() { this = "InsecureTrustManagerTest" }
module InsecureTrustManagerTest implements TestSig {
string getARelevantTag() { result = "hasValueFlow" }
override string getARelevantTag() { result = "hasValueFlow" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasValueFlow" and
exists(DataFlow::Node sink | InsecureTrustManagerFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -16,3 +14,5 @@ class InsecureTrustManagerTest extends InlineExpectationsTest {
)
}
}
import MakeTest<InsecureTrustManagerTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.Mail
import TestUtilities.InlineExpectationsTest
class InsecureJavaMailTest extends InlineExpectationsTest {
InsecureJavaMailTest() { this = "HasInsecureJavaMailTest" }
module InsecureJavaMailTest implements TestSig {
string getARelevantTag() { result = "hasInsecureJavaMail" }
override string getARelevantTag() { result = "hasInsecureJavaMail" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasInsecureJavaMail" and
exists(MethodAccess ma |
ma.getLocation() = location and
@@ -22,3 +20,5 @@ class InsecureJavaMailTest extends InlineExpectationsTest {
)
}
}
import MakeTest<InsecureJavaMailTest>

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.CleartextStorageAndroidDatabaseQuery
import TestUtilities.InlineExpectationsTest
class CleartextStorageAndroidDatabaseTest extends InlineExpectationsTest {
CleartextStorageAndroidDatabaseTest() { this = "CleartextStorageAndroidDatabaseTest" }
module CleartextStorageAndroidDatabaseTest implements TestSig {
string getARelevantTag() { result = "hasCleartextStorageAndroidDatabase" }
override string getARelevantTag() { result = "hasCleartextStorageAndroidDatabase" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasCleartextStorageAndroidDatabase" and
exists(SensitiveSource data, LocalDatabaseOpenMethodAccess s, Expr input, Expr store |
input = s.getAnInput() and
@@ -20,3 +18,5 @@ class CleartextStorageAndroidDatabaseTest extends InlineExpectationsTest {
)
}
}
import MakeTest<CleartextStorageAndroidDatabaseTest>

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.CleartextStorageAndroidFilesystemQuery
import TestUtilities.InlineExpectationsTest
class CleartextStorageAndroidFilesystemTest extends InlineExpectationsTest {
CleartextStorageAndroidFilesystemTest() { this = "CleartextStorageAndroidFilesystemTest" }
module CleartextStorageAndroidFilesystemTest implements TestSig {
string getARelevantTag() { result = "hasCleartextStorageAndroidFilesystem" }
override string getARelevantTag() { result = "hasCleartextStorageAndroidFilesystem" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasCleartextStorageAndroidFilesystem" and
exists(SensitiveSource data, LocalFileOpenCall s, Expr input, Expr store |
input = s.getAnInput() and
@@ -20,3 +18,5 @@ class CleartextStorageAndroidFilesystemTest extends InlineExpectationsTest {
)
}
}
import MakeTest<CleartextStorageAndroidFilesystemTest>

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.CleartextStorageSharedPrefsQuery
import TestUtilities.InlineExpectationsTest
class CleartextStorageSharedPrefsTest extends InlineExpectationsTest {
CleartextStorageSharedPrefsTest() { this = "CleartextStorageSharedPrefsTest" }
module CleartextStorageSharedPrefsTest implements TestSig {
string getARelevantTag() { result = "hasCleartextStorageSharedPrefs" }
override string getARelevantTag() { result = "hasCleartextStorageSharedPrefs" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasCleartextStorageSharedPrefs" and
exists(SensitiveSource data, SharedPreferencesEditorMethodAccess s, Expr input, Expr store |
input = s.getAnInput() and
@@ -20,3 +18,5 @@ class CleartextStorageSharedPrefsTest extends InlineExpectationsTest {
)
}
}
import MakeTest<CleartextStorageSharedPrefsTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -2,12 +2,10 @@ import java
import TestUtilities.InlineExpectationsTest
import semmle.code.java.security.InsufficientKeySizeQuery
class InsufficientKeySizeTest extends InlineExpectationsTest {
InsufficientKeySizeTest() { this = "InsufficientKeySize" }
module InsufficientKeySizeTest implements TestSig {
string getARelevantTag() { result = "hasInsufficientKeySize" }
override string getARelevantTag() { result = "hasInsufficientKeySize" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasInsufficientKeySize" and
exists(KeySizeFlow::PathNode sink | KeySizeFlow::flowPath(_, sink) |
sink.getNode().getLocation() = location and
@@ -16,3 +14,5 @@ class InsufficientKeySizeTest extends InlineExpectationsTest {
)
}
}
import MakeTest<InsufficientKeySizeTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.MissingJWTSignatureCheckQuery
import TestUtilities.InlineExpectationsTest
class HasMissingJwtSignatureCheckTest extends InlineExpectationsTest {
HasMissingJwtSignatureCheckTest() { this = "HasMissingJwtSignatureCheckTest" }
module HasMissingJwtSignatureCheckTest implements TestSig {
string getARelevantTag() { result = "hasMissingJwtSignatureCheck" }
override string getARelevantTag() { result = "hasMissingJwtSignatureCheck" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasMissingJwtSignatureCheck" and
exists(DataFlow::Node sink | MissingJwtSignatureCheckFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -16,3 +14,5 @@ class HasMissingJwtSignatureCheckTest extends InlineExpectationsTest {
)
}
}
import MakeTest<HasMissingJwtSignatureCheckTest>

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.FragmentInjection
import TestUtilities.InlineExpectationsTest
class FragmentInjectionInPreferenceActivityTest extends InlineExpectationsTest {
FragmentInjectionInPreferenceActivityTest() { this = "FragmentInjectionInPreferenceActivityTest" }
module FragmentInjectionInPreferenceActivityTest implements TestSig {
string getARelevantTag() { result = "hasPreferenceFragmentInjection" }
override string getARelevantTag() { result = "hasPreferenceFragmentInjection" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasPreferenceFragmentInjection" and
exists(IsValidFragmentMethod isValidFragment | isValidFragment.isUnsafe() |
isValidFragment.getLocation() = location and
@@ -16,3 +14,5 @@ class FragmentInjectionInPreferenceActivityTest extends InlineExpectationsTest {
)
}
}
import MakeTest<FragmentInjectionInPreferenceActivityTest>

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.xml.AndroidManifest
import TestUtilities.InlineExpectationsTest
class DebuggableAttributeEnabledTest extends InlineExpectationsTest {
DebuggableAttributeEnabledTest() { this = "DebuggableAttributeEnabledTest" }
module DebuggableAttributeEnabledTest implements TestSig {
string getARelevantTag() { result = "hasDebuggableAttributeEnabled" }
override string getARelevantTag() { result = "hasDebuggableAttributeEnabled" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasDebuggableAttributeEnabled" and
exists(AndroidApplicationXmlElement androidAppElem |
androidAppElem.isDebuggable() and
@@ -19,3 +17,5 @@ class DebuggableAttributeEnabledTest extends InlineExpectationsTest {
)
}
}
import MakeTest<DebuggableAttributeEnabledTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.UnsafeDeserializationQuery
import TestUtilities.InlineExpectationsTest
class UnsafeDeserializationTest extends InlineExpectationsTest {
UnsafeDeserializationTest() { this = "UnsafeDeserializationTest" }
module UnsafeDeserializationTest implements TestSig {
string getARelevantTag() { result = "unsafeDeserialization" }
override string getARelevantTag() { result = "unsafeDeserialization" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "unsafeDeserialization" and
exists(DataFlow::Node sink | UnsafeDeserializationFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -16,3 +14,5 @@ class UnsafeDeserializationTest extends InlineExpectationsTest {
)
}
}
import MakeTest<UnsafeDeserializationTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.InsecureBasicAuthQuery
import TestUtilities.InlineExpectationsTest
class HasInsecureBasicAuthTest extends InlineExpectationsTest {
HasInsecureBasicAuthTest() { this = "HasInsecureBasicAuthTest" }
module HasInsecureBasicAuthTest implements TestSig {
string getARelevantTag() { result = "hasInsecureBasicAuth" }
override string getARelevantTag() { result = "hasInsecureBasicAuth" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasInsecureBasicAuth" and
exists(DataFlow::Node sink | InsecureBasicAuthFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -16,3 +14,5 @@ class HasInsecureBasicAuthTest extends InlineExpectationsTest {
)
}
}
import MakeTest<HasInsecureBasicAuthTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.InsecureLdapAuthQuery
import TestUtilities.InlineExpectationsTest
class InsecureLdapAuthenticationTest extends InlineExpectationsTest {
InsecureLdapAuthenticationTest() { this = "InsecureLdapAuthentication" }
module InsecureLdapAuthenticationTest implements TestSig {
string getARelevantTag() { result = "hasInsecureLdapAuth" }
override string getARelevantTag() { result = "hasInsecureLdapAuth" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasInsecureLdapAuth" and
exists(DataFlow::Node sink | InsecureLdapUrlFlow::flowTo(sink) |
BasicAuthFlow::flowTo(sink) and
@@ -18,3 +16,5 @@ class InsecureLdapAuthenticationTest extends InlineExpectationsTest {
)
}
}
import MakeTest<InsecureLdapAuthenticationTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -2,12 +2,10 @@ import java
import semmle.code.java.security.SensitiveKeyboardCacheQuery
import TestUtilities.InlineExpectationsTest
class SensitiveKeyboardCacheTest extends InlineExpectationsTest {
SensitiveKeyboardCacheTest() { this = "SensitiveKeyboardCacheTest" }
module SensitiveKeyboardCacheTest implements TestSig {
string getARelevantTag() { result = "hasResult" }
override string getARelevantTag() { result = "hasResult" }
override predicate hasActualResult(Location loc, string element, string tag, string value) {
predicate hasActualResult(Location loc, string element, string tag, string value) {
exists(AndroidEditableXmlElement el |
el = getASensitiveCachedInput() and
loc = el.getLocation() and
@@ -17,3 +15,5 @@ class SensitiveKeyboardCacheTest extends InlineExpectationsTest {
)
}
}
import MakeTest<SensitiveKeyboardCacheTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -3,12 +3,10 @@ import semmle.code.java.dataflow.DataFlow
import semmle.code.java.security.XPathInjectionQuery
import TestUtilities.InlineExpectationsTest
class HasXPathInjectionTest extends InlineExpectationsTest {
HasXPathInjectionTest() { this = "HasXPathInjectionTest" }
module HasXPathInjectionTest implements TestSig {
string getARelevantTag() { result = "hasXPathInjection" }
override string getARelevantTag() { result = "hasXPathInjection" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasXPathInjection" and
exists(DataFlow::Node sink | XPathInjectionFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -17,3 +15,5 @@ class HasXPathInjectionTest extends InlineExpectationsTest {
)
}
}
import MakeTest<HasXPathInjectionTest>

View File

@@ -0,0 +1,2 @@
failures
testFailures

View File

@@ -1,12 +1,10 @@
import TestUtilities.InlineExpectationsTest
import semmle.code.java.security.regexp.PolynomialReDoSQuery
class HasPolyRedos extends InlineExpectationsTest {
HasPolyRedos() { this = "HasPolyRedos" }
module HasPolyRedos implements TestSig {
string getARelevantTag() { result = "hasPolyRedos" }
override string getARelevantTag() { result = "hasPolyRedos" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasPolyRedos" and
exists(DataFlow::Node sink |
PolynomialRedosFlow::flowTo(sink) and
@@ -16,3 +14,5 @@ class HasPolyRedos extends InlineExpectationsTest {
)
}
}
import MakeTest<HasPolyRedos>

Some files were not shown because too many files have changed in this diff Show More