Go: Adjust hasActualResult overrides

This commit is contained in:
Rasmus Wriedt Larsen
2022-06-02 14:55:27 +02:00
parent 86caf747f3
commit 3f857e113c
37 changed files with 46 additions and 46 deletions

View File

@@ -76,7 +76,7 @@ class InlineFlowTest extends InlineExpectationsTest {
override string getARelevantTag() { result = ["hasValueFlow", "hasTaintFlow"] }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasValueFlow" and
exists(DataFlow::Node src, DataFlow::Node sink | getValueFlowConfig().hasFlow(src, sink) |
sink.hasLocationInfo(file, line, _, _, _) and

View File

@@ -9,7 +9,7 @@ class HttpHeaderWriteTest extends InlineExpectationsTest {
result = ["headerKeyNode", "headerValNode", "headerKey", "headerVal"]
}
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
// Dynamic key-value header:
exists(HTTP::HeaderWrite hw |
hw.hasLocationInfo(file, line, _, _, _) and

View File

@@ -7,7 +7,7 @@ class HttpRedirectTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "redirectUrl" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "redirectUrl" and
exists(HTTP::Redirect rd |
rd.hasLocationInfo(file, line, _, _, _) and

View File

@@ -7,7 +7,7 @@ class HttpResponseBodyTest extends InlineExpectationsTest {
override string getARelevantTag() { result = ["contentType", "responseBody"] }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(HTTP::ResponseBody rd |
rd.hasLocationInfo(file, line, _, _, _) and
(

View File

@@ -19,7 +19,7 @@ class TaintTrackingTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "taintSink" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override 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

View File

@@ -7,7 +7,7 @@ class UntrustedFlowSourceTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "untrustedFlowSource" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "untrustedFlowSource" and
exists(DataFlow::CallNode sinkCall, DataFlow::ArgumentNode arg |
sinkCall.getCalleeName() = "sink" and

View File

@@ -9,7 +9,7 @@ class HttpHeaderWriteTest extends InlineExpectationsTest {
result = ["headerKeyNode", "headerValNode", "headerKey", "headerVal"]
}
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
// Dynamic key-value header:
exists(HTTP::HeaderWrite hw |
hw.hasLocationInfo(file, line, _, _, _) and

View File

@@ -7,7 +7,7 @@ class HttpRedirectTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "redirectUrl" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "redirectUrl" and
exists(HTTP::Redirect rd |
rd.hasLocationInfo(file, line, _, _, _) and

View File

@@ -7,7 +7,7 @@ class HttpResponseBodyTest extends InlineExpectationsTest {
override string getARelevantTag() { result = ["contentType", "responseBody"] }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(HTTP::ResponseBody rd |
rd.hasLocationInfo(file, line, _, _, _) and
(

View File

@@ -19,7 +19,7 @@ class TaintTrackingTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "taintSink" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override 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

View File

@@ -7,7 +7,7 @@ class UntrustedFlowSourceTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "untrustedFlowSource" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "untrustedFlowSource" and
exists(DataFlow::CallNode sinkCall, DataFlow::ArgumentNode arg |
sinkCall.getCalleeName() = "sink" and

View File

@@ -6,7 +6,7 @@ class FunctionIsVariadicTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "isVariadic" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(CallExpr ce |
ce.getTarget().isVariadic() and
ce.hasLocationInfo(file, line, _, _, _) and

View File

@@ -6,7 +6,7 @@ class ImplementsComparableTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "implementsComparable" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
// file = "interface.go" and
tag = "implementsComparable" and
exists(TypeSpec ts |

View File

@@ -6,7 +6,7 @@ class SignatureTypeIsVariadicTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "isVariadic" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(FuncDef fd |
fd.isVariadic() and
fd.hasLocationInfo(file, line, _, _, _) and

View File

@@ -6,7 +6,7 @@ class HttpHandler extends InlineExpectationsTest {
override string getARelevantTag() { result = "handler" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override 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()

View File

@@ -6,7 +6,7 @@ class LoggerTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "logger" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(LoggerCall log |
log.hasLocationInfo(file, line, _, _, _) and
element = log.toString() and

View File

@@ -34,7 +34,7 @@ class DataFlowTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "dataflow" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override 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
@@ -61,7 +61,7 @@ class TaintFlowTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "taintflow" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override 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

View File

@@ -28,7 +28,7 @@ class DataFlowTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "dataflow" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override 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

View File

@@ -18,7 +18,7 @@ class DataFlowTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "dataflow" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override 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

View File

@@ -26,7 +26,7 @@ class PromotedFieldsTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "promotedfields" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(TestConfig config, DataFlow::PathNode source, DataFlow::PathNode sink |
config.hasFlowPath(source, sink) and
sink.hasLocationInfo(file, line, _, _, _) and

View File

@@ -26,7 +26,7 @@ class PromotedMethodsTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "promotedmethods" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(TestConfig config, DataFlow::Node source, DataFlow::Node sink |
config.hasFlow(source, sink)
|

View File

@@ -18,7 +18,7 @@ class DataFlowTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "dataflow" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override 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

View File

@@ -18,7 +18,7 @@ class DataFlowTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "dataflow" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override 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
@@ -45,7 +45,7 @@ class TaintFlowTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "taintflow" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override 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

View File

@@ -50,7 +50,7 @@ class DataFlowTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "dataflow" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override 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
@@ -79,7 +79,7 @@ class TaintFlowTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "taintflow" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override 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

View File

@@ -7,7 +7,7 @@ class SqlInjectionTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "sqlinjection" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override 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

View File

@@ -6,7 +6,7 @@ class UntrustedFlowSourceTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "untrustedflowsource" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "untrustedflowsource" and
value = element and
exists(UntrustedFlowSource src | value = "\"" + src.toString() + "\"" |
@@ -20,7 +20,7 @@ class HeaderWriteTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "headerwrite" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "headerwrite" and
exists(HTTP::HeaderWrite hw, string name, string val | element = hw.toString() |
hw.definesHeader(name, val) and
@@ -35,7 +35,7 @@ class LoggerTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "logger" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(LoggerCall log |
log.hasLocationInfo(file, line, _, _, _) and
element = log.toString() and

View File

@@ -21,7 +21,7 @@ class TaintFlowTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "taintflow" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override 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

View File

@@ -7,7 +7,7 @@ class UntrustedFlowSourceTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "source" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(UntrustedFlowSource source |
source.hasLocationInfo(file, line, _, _, _) and
element = source.toString() and

View File

@@ -26,7 +26,7 @@ class K8sIoApiCoreV1Test extends InlineExpectationsTest {
override string getARelevantTag() { result = "KsIoApiCoreV" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(TestConfig config, DataFlow::PathNode source, DataFlow::PathNode sink |
config.hasFlowPath(source, sink) and
sink.hasLocationInfo(file, line, _, _, _) and

View File

@@ -26,7 +26,7 @@ class K8sIoApimachineryPkgRuntimeTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "KsIoApimachineryPkgRuntime" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(TestConfig config, DataFlow::PathNode source, DataFlow::PathNode sink |
config.hasFlowPath(source, sink) and
sink.hasLocationInfo(file, line, _, _, _) and

View File

@@ -6,7 +6,7 @@ class K8sIoApimachineryPkgRuntimeTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "KsIoClientGo" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(K8sIoClientGo::SecretInterfaceSource source |
source.hasLocationInfo(file, line, _, _, _) and
element = source.toString() and

View File

@@ -6,7 +6,7 @@ class NoSQLQueryTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "nosqlquery" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(NoSQL::Query q |
q.hasLocationInfo(file, line, _, _, _) and
element = q.toString() and

View File

@@ -20,7 +20,7 @@ class MissingDataFlowTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "noflow" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "noflow" and
value = "" and
exists(Sink sink |
@@ -36,7 +36,7 @@ class HttpResponseBodyTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "responsebody" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "responsebody" and
exists(HTTP::ResponseBody rb |
rb.hasLocationInfo(file, line, _, _, _) and

View File

@@ -6,7 +6,7 @@ class SQLTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "query" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "query" and
exists(SQL::Query q, SQL::QueryString qs, string qsFile, int qsLine | qs = q.getAQueryString() |
q.hasLocationInfo(file, line, _, _, _) and
@@ -22,7 +22,7 @@ class QueryString extends InlineExpectationsTest {
override string getARelevantTag() { result = "querystring" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "querystring" and
element = "" and
exists(SQL::QueryString qs | not exists(SQL::Query q | qs = q.getAQueryString()) |

View File

@@ -6,7 +6,7 @@ class FileSystemAccessTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "fsaccess" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(FileSystemAccess f |
f.hasLocationInfo(file, line, _, _, _) and
element = f.toString() and

View File

@@ -6,7 +6,7 @@ class TaintFunctionModelTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "ttfnmodelstep" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "ttfnmodelstep" and
exists(TaintTracking::FunctionModel model, DataFlow::CallNode call | call = model.getACall() |
call.hasLocationInfo(file, line, _, _, _) and
@@ -21,7 +21,7 @@ class MarshalerTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "marshaler" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "marshaler" and
exists(MarshalingFunction m, DataFlow::CallNode call | call = m.getACall() |
call.hasLocationInfo(file, line, _, _, _) and
@@ -38,7 +38,7 @@ class UnmarshalerTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "unmarshaler" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "unmarshaler" and
exists(UnmarshalingFunction m, DataFlow::CallNode call | call = m.getACall() |
call.hasLocationInfo(file, line, _, _, _) and

View File

@@ -18,7 +18,7 @@ class ZapTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "zap" }
override predicate hasActualResult(string file, int line, string element, string tag, string value) {
override 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