mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01: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
|
||||
|
||||
@@ -2,14 +2,10 @@ import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
import experimental.frameworks.CleverGo
|
||||
|
||||
class HttpHeaderWriteTest extends InlineExpectationsTest {
|
||||
HttpHeaderWriteTest() { this = "HttpHeaderWriteTest" }
|
||||
module HttpHeaderWriteTest implements TestSig {
|
||||
string getARelevantTag() { result = ["headerKeyNode", "headerValNode", "headerKey", "headerVal"] }
|
||||
|
||||
override string getARelevantTag() {
|
||||
result = ["headerKeyNode", "headerValNode", "headerKey", "headerVal"]
|
||||
}
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
// Dynamic key-value header:
|
||||
exists(Http::HeaderWrite hw |
|
||||
hw.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
@@ -56,3 +52,5 @@ class HttpHeaderWriteTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<HttpHeaderWriteTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -2,12 +2,10 @@ import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
import experimental.frameworks.CleverGo
|
||||
|
||||
class HttpRedirectTest extends InlineExpectationsTest {
|
||||
HttpRedirectTest() { this = "HttpRedirectTest" }
|
||||
module HttpRedirectTest implements TestSig {
|
||||
string getARelevantTag() { result = "redirectUrl" }
|
||||
|
||||
override string getARelevantTag() { result = "redirectUrl" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "redirectUrl" and
|
||||
exists(Http::Redirect rd |
|
||||
rd.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
@@ -17,3 +15,5 @@ class HttpRedirectTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<HttpRedirectTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -2,12 +2,10 @@ import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
import experimental.frameworks.CleverGo
|
||||
|
||||
class HttpResponseBodyTest extends InlineExpectationsTest {
|
||||
HttpResponseBodyTest() { this = "HttpResponseBodyTest" }
|
||||
module HttpResponseBodyTest implements TestSig {
|
||||
string getARelevantTag() { result = ["contentType", "responseBody"] }
|
||||
|
||||
override string getARelevantTag() { result = ["contentType", "responseBody"] }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(Http::ResponseBody rd |
|
||||
rd.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
location.getStartColumn(), location.getEndLine(), location.getEndColumn()) and
|
||||
@@ -23,3 +21,5 @@ class HttpResponseBodyTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<HttpResponseBodyTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -14,12 +14,10 @@ class Configuration extends TaintTracking::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class TaintTrackingTest extends InlineExpectationsTest {
|
||||
TaintTrackingTest() { this = "TaintTrackingTest" }
|
||||
module TaintTrackingTest implements TestSig {
|
||||
string getARelevantTag() { result = "taintSink" }
|
||||
|
||||
override string getARelevantTag() { result = "taintSink" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "taintSink" and
|
||||
exists(DataFlow::Node sink | any(Configuration c).hasFlow(_, sink) |
|
||||
element = sink.toString() and
|
||||
@@ -29,3 +27,5 @@ class TaintTrackingTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<TaintTrackingTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -2,12 +2,10 @@ import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
import experimental.frameworks.CleverGo
|
||||
|
||||
class UntrustedFlowSourceTest extends InlineExpectationsTest {
|
||||
UntrustedFlowSourceTest() { this = "UntrustedFlowSourceTest" }
|
||||
module UntrustedFlowSourceTest implements TestSig {
|
||||
string getARelevantTag() { result = "untrustedFlowSource" }
|
||||
|
||||
override string getARelevantTag() { result = "untrustedFlowSource" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "untrustedFlowSource" and
|
||||
exists(DataFlow::CallNode sinkCall, DataFlow::ArgumentNode arg |
|
||||
sinkCall.getCalleeName() = "sink" and
|
||||
@@ -21,3 +19,5 @@ class UntrustedFlowSourceTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<UntrustedFlowSourceTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -2,14 +2,10 @@ import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
import experimental.frameworks.Fiber
|
||||
|
||||
class HttpHeaderWriteTest extends InlineExpectationsTest {
|
||||
HttpHeaderWriteTest() { this = "HttpHeaderWriteTest" }
|
||||
module HttpHeaderWriteTest implements TestSig {
|
||||
string getARelevantTag() { result = ["headerKeyNode", "headerValNode", "headerKey", "headerVal"] }
|
||||
|
||||
override string getARelevantTag() {
|
||||
result = ["headerKeyNode", "headerValNode", "headerKey", "headerVal"]
|
||||
}
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
// Dynamic key-value header:
|
||||
exists(Http::HeaderWrite hw |
|
||||
hw.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
@@ -56,3 +52,5 @@ class HttpHeaderWriteTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<HttpHeaderWriteTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -2,12 +2,10 @@ import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
import experimental.frameworks.Fiber
|
||||
|
||||
class HttpRedirectTest extends InlineExpectationsTest {
|
||||
HttpRedirectTest() { this = "HttpRedirectTest" }
|
||||
module HttpRedirectTest implements TestSig {
|
||||
string getARelevantTag() { result = "redirectUrl" }
|
||||
|
||||
override string getARelevantTag() { result = "redirectUrl" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "redirectUrl" and
|
||||
exists(Http::Redirect rd |
|
||||
rd.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
@@ -17,3 +15,5 @@ class HttpRedirectTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<HttpRedirectTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -2,12 +2,10 @@ import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
import experimental.frameworks.Fiber
|
||||
|
||||
class HttpResponseBodyTest extends InlineExpectationsTest {
|
||||
HttpResponseBodyTest() { this = "HttpResponseBodyTest" }
|
||||
module HttpResponseBodyTest implements TestSig {
|
||||
string getARelevantTag() { result = ["contentType", "responseBody"] }
|
||||
|
||||
override string getARelevantTag() { result = ["contentType", "responseBody"] }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(Http::ResponseBody rd |
|
||||
rd.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
location.getStartColumn(), location.getEndLine(), location.getEndColumn()) and
|
||||
@@ -23,3 +21,5 @@ class HttpResponseBodyTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<HttpResponseBodyTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -14,12 +14,10 @@ class Configuration extends TaintTracking::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class TaintTrackingTest extends InlineExpectationsTest {
|
||||
TaintTrackingTest() { this = "TaintTrackingTest" }
|
||||
module TaintTrackingTest implements TestSig {
|
||||
string getARelevantTag() { result = "taintSink" }
|
||||
|
||||
override string getARelevantTag() { result = "taintSink" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "taintSink" and
|
||||
exists(DataFlow::Node sink | any(Configuration c).hasFlow(_, sink) |
|
||||
element = sink.toString() and
|
||||
@@ -29,3 +27,5 @@ class TaintTrackingTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<TaintTrackingTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -2,12 +2,10 @@ import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
import experimental.frameworks.Fiber
|
||||
|
||||
class UntrustedFlowSourceTest extends InlineExpectationsTest {
|
||||
UntrustedFlowSourceTest() { this = "UntrustedFlowSourceTest" }
|
||||
module UntrustedFlowSourceTest implements TestSig {
|
||||
string getARelevantTag() { result = "untrustedFlowSource" }
|
||||
|
||||
override string getARelevantTag() { result = "untrustedFlowSource" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "untrustedFlowSource" and
|
||||
exists(DataFlow::CallNode sinkCall, DataFlow::ArgumentNode arg |
|
||||
sinkCall.getCalleeName() = "sink" and
|
||||
@@ -21,3 +19,5 @@ class UntrustedFlowSourceTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<UntrustedFlowSourceTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class FunctionIsVariadicTest extends InlineExpectationsTest {
|
||||
FunctionIsVariadicTest() { this = "Function::IsVariadicTest" }
|
||||
module FunctionIsVariadicTest implements TestSig {
|
||||
string getARelevantTag() { result = "isVariadic" }
|
||||
|
||||
override string getARelevantTag() { result = "isVariadic" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(CallExpr ce |
|
||||
ce.getTarget().isVariadic() and
|
||||
ce.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
@@ -17,3 +15,5 @@ class FunctionIsVariadicTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<FunctionIsVariadicTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class ImplementsComparableTest extends InlineExpectationsTest {
|
||||
ImplementsComparableTest() { this = "ImplementsComparableTest" }
|
||||
module ImplementsComparableTest implements TestSig {
|
||||
string getARelevantTag() { result = "implementsComparable" }
|
||||
|
||||
override string getARelevantTag() { result = "implementsComparable" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
// file = "interface.go" and
|
||||
tag = "implementsComparable" and
|
||||
exists(TypeSpec ts |
|
||||
@@ -20,3 +18,5 @@ class ImplementsComparableTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<ImplementsComparableTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class SignatureTypeIsVariadicTest extends InlineExpectationsTest {
|
||||
SignatureTypeIsVariadicTest() { this = "SignatureType::IsVariadicTest" }
|
||||
module SignatureTypeIsVariadicTest implements TestSig {
|
||||
string getARelevantTag() { result = "isVariadic" }
|
||||
|
||||
override string getARelevantTag() { result = "isVariadic" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(FuncDef fd |
|
||||
fd.isVariadic() and
|
||||
fd.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
@@ -17,3 +15,5 @@ class SignatureTypeIsVariadicTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<SignatureTypeIsVariadicTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class HttpHandler extends InlineExpectationsTest {
|
||||
HttpHandler() { this = "httphandler" }
|
||||
module HttpHandler implements TestSig {
|
||||
string getARelevantTag() { result = "handler" }
|
||||
|
||||
override string getARelevantTag() { result = "handler" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "handler" and
|
||||
exists(Http::RequestHandler h, DataFlow::Node check |
|
||||
element = h.toString() and value = check.toString()
|
||||
@@ -17,3 +15,5 @@ class HttpHandler extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<HttpHandler>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class LoggerTest extends InlineExpectationsTest {
|
||||
LoggerTest() { this = "LoggerTest" }
|
||||
module LoggerTest implements TestSig {
|
||||
string getARelevantTag() { result = "logger" }
|
||||
|
||||
override string getARelevantTag() { result = "logger" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(LoggerCall log |
|
||||
log.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
location.getStartColumn(), location.getEndLine(), location.getEndColumn()) and
|
||||
@@ -16,3 +14,5 @@ class LoggerTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<LoggerTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -13,12 +13,10 @@ class DataConfiguration extends DataFlow::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class DataFlowTest extends InlineExpectationsTest {
|
||||
DataFlowTest() { this = "DataFlowTest" }
|
||||
module DataFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "dataflow" }
|
||||
|
||||
override string getARelevantTag() { result = "dataflow" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "dataflow" and
|
||||
exists(DataFlow::Node sink | any(DataConfiguration c).hasFlow(_, sink) |
|
||||
element = sink.toString() and
|
||||
@@ -41,12 +39,10 @@ class TaintConfiguration extends TaintTracking::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class TaintFlowTest extends InlineExpectationsTest {
|
||||
TaintFlowTest() { this = "TaintFlowTest" }
|
||||
module TaintFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "taintflow" }
|
||||
|
||||
override string getARelevantTag() { result = "taintflow" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "taintflow" and
|
||||
exists(DataFlow::Node sink | any(TaintConfiguration c).hasFlow(_, sink) |
|
||||
element = sink.toString() and
|
||||
@@ -56,3 +52,5 @@ class TaintFlowTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<MergeTests<DataFlowTest, TaintFlowTest>>
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
failures
|
||||
invalidModelRow
|
||||
testFailures
|
||||
|
||||
@@ -15,12 +15,10 @@ class DataConfiguration extends DataFlow::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class DataFlowTest extends InlineExpectationsTest {
|
||||
DataFlowTest() { this = "DataFlowTest" }
|
||||
module DataFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "dataflow" }
|
||||
|
||||
override string getARelevantTag() { result = "dataflow" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "dataflow" and
|
||||
exists(DataFlow::Node sink | any(DataConfiguration c).hasFlow(_, sink) |
|
||||
element = sink.toString() and
|
||||
@@ -43,12 +41,10 @@ class TaintConfiguration extends TaintTracking::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class TaintFlowTest extends InlineExpectationsTest {
|
||||
TaintFlowTest() { this = "TaintFlowTest" }
|
||||
module TaintFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "taintflow" }
|
||||
|
||||
override string getARelevantTag() { result = "taintflow" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "taintflow" and
|
||||
exists(DataFlow::Node sink | any(TaintConfiguration c).hasFlow(_, sink) |
|
||||
element = sink.toString() and
|
||||
@@ -58,3 +54,5 @@ class TaintFlowTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<MergeTests<DataFlowTest, TaintFlowTest>>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -23,12 +23,10 @@ class TestConfig extends DataFlow::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class DataFlowTest extends InlineExpectationsTest {
|
||||
DataFlowTest() { this = "DataFlowTest" }
|
||||
module DataFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "dataflow" }
|
||||
|
||||
override string getARelevantTag() { result = "dataflow" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "dataflow" and
|
||||
exists(DataFlow::Node sink | any(TestConfig c).hasFlow(_, sink) |
|
||||
element = sink.toString() and
|
||||
@@ -38,3 +36,5 @@ class DataFlowTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<DataFlowTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -13,12 +13,10 @@ class TestConfig extends TaintTracking::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class DataFlowTest extends InlineExpectationsTest {
|
||||
DataFlowTest() { this = "DataFlowTest" }
|
||||
module DataFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "dataflow" }
|
||||
|
||||
override string getARelevantTag() { result = "dataflow" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "dataflow" and
|
||||
exists(DataFlow::Node sink | any(TestConfig c).hasFlow(_, sink) |
|
||||
element = sink.toString() and
|
||||
@@ -28,3 +26,5 @@ class DataFlowTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<DataFlowTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -21,12 +21,10 @@ class TestConfig extends DataFlow::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class PromotedFieldsTest extends InlineExpectationsTest {
|
||||
PromotedFieldsTest() { this = "PromotedFieldsTest" }
|
||||
module PromotedFieldsTest implements TestSig {
|
||||
string getARelevantTag() { result = "promotedfields" }
|
||||
|
||||
override string getARelevantTag() { result = "promotedfields" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(TestConfig config, DataFlow::PathNode sink |
|
||||
config.hasFlowPath(_, sink) and
|
||||
sink.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
@@ -37,3 +35,5 @@ class PromotedFieldsTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<PromotedFieldsTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -21,12 +21,10 @@ class TestConfig extends DataFlow::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class PromotedMethodsTest extends InlineExpectationsTest {
|
||||
PromotedMethodsTest() { this = "PromotedMethodsTest" }
|
||||
module PromotedMethodsTest implements TestSig {
|
||||
string getARelevantTag() { result = "promotedmethods" }
|
||||
|
||||
override string getARelevantTag() { result = "promotedmethods" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(TestConfig config, DataFlow::Node source, DataFlow::Node sink |
|
||||
config.hasFlow(source, sink)
|
||||
|
|
||||
@@ -38,3 +36,5 @@ class PromotedMethodsTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<PromotedMethodsTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -13,12 +13,10 @@ class Configuration extends DataFlow::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class DataFlowTest extends InlineExpectationsTest {
|
||||
DataFlowTest() { this = "DataFlowTest" }
|
||||
module DataFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "dataflow" }
|
||||
|
||||
override string getARelevantTag() { result = "dataflow" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "dataflow" and
|
||||
exists(DataFlow::Node sink | any(Configuration c).hasFlow(_, sink) |
|
||||
element = sink.toString() and
|
||||
@@ -28,3 +26,5 @@ class DataFlowTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<DataFlowTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -13,12 +13,10 @@ class DataConfiguration extends DataFlow::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class DataFlowTest extends InlineExpectationsTest {
|
||||
DataFlowTest() { this = "DataFlowTest" }
|
||||
module DataFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "dataflow" }
|
||||
|
||||
override string getARelevantTag() { result = "dataflow" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "dataflow" and
|
||||
exists(DataFlow::Node sink | any(DataConfiguration c).hasFlow(_, sink) |
|
||||
element = sink.toString() and
|
||||
@@ -41,12 +39,10 @@ class TaintConfiguration extends TaintTracking::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class TaintFlowTest extends InlineExpectationsTest {
|
||||
TaintFlowTest() { this = "TaintFlowTest" }
|
||||
module TaintFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "taintflow" }
|
||||
|
||||
override string getARelevantTag() { result = "taintflow" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "taintflow" and
|
||||
exists(DataFlow::Node sink | any(TaintConfiguration c).hasFlow(_, sink) |
|
||||
element = sink.toString() and
|
||||
@@ -56,3 +52,5 @@ class TaintFlowTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<MergeTests<DataFlowTest, TaintFlowTest>>
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
failures
|
||||
invalidModelRow
|
||||
testFailures
|
||||
|
||||
@@ -43,12 +43,10 @@ class DataConfiguration extends DataFlow::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class DataFlowTest extends InlineExpectationsTest {
|
||||
DataFlowTest() { this = "DataFlowTest" }
|
||||
module DataFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "dataflow" }
|
||||
|
||||
override string getARelevantTag() { result = "dataflow" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "dataflow" and
|
||||
exists(DataFlow::Node sink | any(DataConfiguration c).hasFlow(_, sink) |
|
||||
element = sink.toString() and
|
||||
@@ -71,12 +69,10 @@ class TaintConfiguration extends TaintTracking::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class TaintFlowTest extends InlineExpectationsTest {
|
||||
TaintFlowTest() { this = "TaintFlowTest" }
|
||||
module TaintFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "taintflow" }
|
||||
|
||||
override string getARelevantTag() { result = "taintflow" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "taintflow" and
|
||||
exists(DataFlow::Node sink | any(TaintConfiguration c).hasFlow(_, sink) |
|
||||
element = sink.toString() and
|
||||
@@ -86,6 +82,8 @@ class TaintFlowTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<MergeTests<DataFlowTest, TaintFlowTest>>
|
||||
// from TaintConfiguration cfg, DataFlow::PartialPathNode source, DataFlow::PartialPathNode sink
|
||||
// where
|
||||
// cfg.hasPartialFlow(source, sink, _)
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -2,12 +2,10 @@ import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
import semmle.go.security.SqlInjection
|
||||
|
||||
class SqlInjectionTest extends InlineExpectationsTest {
|
||||
SqlInjectionTest() { this = "SqlInjectionTest" }
|
||||
module SqlInjectionTest 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 | any(SqlInjection::Configuration c).hasFlow(_, sink) |
|
||||
element = sink.toString() and
|
||||
@@ -17,3 +15,5 @@ class SqlInjectionTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<SqlInjectionTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -16,12 +16,10 @@ class Configuration extends TaintTracking::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class TaintFlowTest extends InlineExpectationsTest {
|
||||
TaintFlowTest() { this = "TaintFlowTest" }
|
||||
module TaintFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "taintflow" }
|
||||
|
||||
override string getARelevantTag() { result = "taintflow" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "taintflow" and
|
||||
exists(DataFlow::Node sink | any(Configuration c).hasFlow(_, sink) |
|
||||
element = sink.toString() and
|
||||
@@ -31,3 +29,5 @@ class TaintFlowTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<TaintFlowTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -2,12 +2,10 @@ import go
|
||||
import semmle.go.frameworks.GoKit
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class UntrustedFlowSourceTest extends InlineExpectationsTest {
|
||||
UntrustedFlowSourceTest() { this = "untrustedflowsourcetest" }
|
||||
module UntrustedFlowSourceTest 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) {
|
||||
exists(UntrustedFlowSource source |
|
||||
source
|
||||
.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
@@ -18,3 +16,5 @@ class UntrustedFlowSourceTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<UntrustedFlowSourceTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -21,12 +21,10 @@ class TestConfig extends TaintTracking::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class K8sIoApiCoreV1Test extends InlineExpectationsTest {
|
||||
K8sIoApiCoreV1Test() { this = "K8sIoApiCoreV1Test" }
|
||||
module K8sIoApiCoreV1Test implements TestSig {
|
||||
string getARelevantTag() { result = "KsIoApiCoreV" }
|
||||
|
||||
override string getARelevantTag() { result = "KsIoApiCoreV" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(TestConfig config, DataFlow::PathNode sink |
|
||||
config.hasFlowPath(_, sink) and
|
||||
sink.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
@@ -37,3 +35,5 @@ class K8sIoApiCoreV1Test extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<K8sIoApiCoreV1Test>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -21,12 +21,10 @@ class TestConfig extends TaintTracking::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class K8sIoApimachineryPkgRuntimeTest extends InlineExpectationsTest {
|
||||
K8sIoApimachineryPkgRuntimeTest() { this = "KsIoApimachineryPkgRuntimeTest" }
|
||||
module K8sIoApimachineryPkgRuntimeTest implements TestSig {
|
||||
string getARelevantTag() { result = "KsIoApimachineryPkgRuntime" }
|
||||
|
||||
override string getARelevantTag() { result = "KsIoApimachineryPkgRuntime" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(TestConfig config, DataFlow::PathNode sink |
|
||||
config.hasFlowPath(_, sink) and
|
||||
sink.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
@@ -37,3 +35,5 @@ class K8sIoApimachineryPkgRuntimeTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<K8sIoApimachineryPkgRuntimeTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class K8sIoApimachineryPkgRuntimeTest extends InlineExpectationsTest {
|
||||
K8sIoApimachineryPkgRuntimeTest() { this = "KsIoClientGoTest" }
|
||||
module K8sIoApimachineryPkgRuntimeTest implements TestSig {
|
||||
string getARelevantTag() { result = "KsIoClientGo" }
|
||||
|
||||
override string getARelevantTag() { result = "KsIoClientGo" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(K8sIoClientGo::SecretInterfaceSource source |
|
||||
source
|
||||
.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
@@ -17,3 +15,5 @@ class K8sIoApimachineryPkgRuntimeTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<K8sIoApimachineryPkgRuntimeTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class NoSqlQueryTest extends InlineExpectationsTest {
|
||||
NoSqlQueryTest() { this = "NoSQLQueryTest" }
|
||||
module NoSqlQueryTest implements TestSig {
|
||||
string getARelevantTag() { result = "nosqlquery" }
|
||||
|
||||
override string getARelevantTag() { result = "nosqlquery" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(NoSql::Query q |
|
||||
q.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
location.getStartColumn(), location.getEndLine(), location.getEndColumn()) and
|
||||
@@ -16,3 +14,5 @@ class NoSqlQueryTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<NoSqlQueryTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -15,12 +15,10 @@ class TestConfig extends TaintTracking::Configuration {
|
||||
override predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
|
||||
}
|
||||
|
||||
class MissingDataFlowTest extends InlineExpectationsTest {
|
||||
MissingDataFlowTest() { this = "MissingDataFlow" }
|
||||
module MissingDataFlowTest implements TestSig {
|
||||
string getARelevantTag() { result = "noflow" }
|
||||
|
||||
override string getARelevantTag() { result = "noflow" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "noflow" and
|
||||
value = "" and
|
||||
exists(Sink sink |
|
||||
@@ -32,12 +30,10 @@ class MissingDataFlowTest extends InlineExpectationsTest {
|
||||
}
|
||||
}
|
||||
|
||||
class HttpResponseBodyTest extends InlineExpectationsTest {
|
||||
HttpResponseBodyTest() { this = "HttpResponseBodyTest" }
|
||||
module HttpResponseBodyTest implements TestSig {
|
||||
string getARelevantTag() { result = "responsebody" }
|
||||
|
||||
override string getARelevantTag() { result = "responsebody" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "responsebody" and
|
||||
exists(Http::ResponseBody rb |
|
||||
rb.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
@@ -47,3 +43,5 @@ class HttpResponseBodyTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<MergeTests<MissingDataFlowTest, HttpResponseBodyTest>>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class FileSystemAccessTest extends InlineExpectationsTest {
|
||||
FileSystemAccessTest() { this = "FileSystemAccess" }
|
||||
module FileSystemAccessTest implements TestSig {
|
||||
string getARelevantTag() { result = "fsaccess" }
|
||||
|
||||
override string getARelevantTag() { result = "fsaccess" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(FileSystemAccess f |
|
||||
f.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
|
||||
location.getStartColumn(), location.getEndLine(), location.getEndColumn()) and
|
||||
@@ -16,3 +14,5 @@ class FileSystemAccessTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<FileSystemAccessTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -13,12 +13,10 @@ class TestConfig extends TaintTracking::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class ZapTest extends InlineExpectationsTest {
|
||||
ZapTest() { this = "ZapTest" }
|
||||
module ZapTest implements TestSig {
|
||||
string getARelevantTag() { result = "zap" }
|
||||
|
||||
override string getARelevantTag() { result = "zap" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "zap" and
|
||||
exists(DataFlow::Node sink | any(TestConfig c).hasFlow(_, sink) |
|
||||
element = sink.toString() and
|
||||
@@ -28,3 +26,5 @@ class ZapTest extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<ZapTest>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -2,12 +2,10 @@ import go
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
import semmle.go.security.IncorrectIntegerConversionLib
|
||||
|
||||
class TestIncorrectIntegerConversion extends InlineExpectationsTest {
|
||||
TestIncorrectIntegerConversion() { this = "TestIncorrectIntegerConversion" }
|
||||
module TestIncorrectIntegerConversion 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, DataFlow::Node sinkConverted |
|
||||
any(ConversionWithoutBoundsCheckConfig config).hasFlowTo(sink) and
|
||||
@@ -21,3 +19,5 @@ class TestIncorrectIntegerConversion extends InlineExpectationsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<TestIncorrectIntegerConversion>
|
||||
|
||||
Reference in New Issue
Block a user