Compare commits

..

1 Commits

Author SHA1 Message Date
Alexandre Boulgakov
e1b835b242 Swift: Build incompatible OS diagnostic on all platforms. 2023-06-12 16:50:18 +01:00
292 changed files with 7368 additions and 7930 deletions

View File

@@ -1,3 +1,3 @@
build --repo_env=CC=clang --repo_env=CXX=clang++ --cxxopt="-std=c++20"
build --repo_env=CC=clang --repo_env=CXX=clang++ --cxxopt="-std=c++17"
try-import %workspace%/local.bazelrc

View File

@@ -120,13 +120,13 @@ namespace Semmle.BuildAnalyser
UseReference(filename);
}
ResolveConflicts();
if (options.UseMscorlib)
{
UseReference(typeof(object).Assembly.Location);
}
ResolveConflicts();
// Output the findings
foreach (var r in usedReferences.Keys)
{

View File

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

View File

@@ -2,10 +2,14 @@ import go
import TestUtilities.InlineExpectationsTest
import experimental.frameworks.CleverGo
module HttpHeaderWriteTest implements TestSig {
string getARelevantTag() { result = ["headerKeyNode", "headerValNode", "headerKey", "headerVal"] }
class HttpHeaderWriteTest extends InlineExpectationsTest {
HttpHeaderWriteTest() { this = "HttpHeaderWriteTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() {
result = ["headerKeyNode", "headerValNode", "headerKey", "headerVal"]
}
override 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(),
@@ -52,5 +56,3 @@ module HttpHeaderWriteTest implements TestSig {
)
}
}
import MakeTest<HttpHeaderWriteTest>

View File

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

View File

@@ -2,10 +2,12 @@ import go
import TestUtilities.InlineExpectationsTest
import experimental.frameworks.CleverGo
module HttpRedirectTest implements TestSig {
string getARelevantTag() { result = "redirectUrl" }
class HttpRedirectTest extends InlineExpectationsTest {
HttpRedirectTest() { this = "HttpRedirectTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "redirectUrl" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "redirectUrl" and
exists(Http::Redirect rd |
rd.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
@@ -15,5 +17,3 @@ module HttpRedirectTest implements TestSig {
)
}
}
import MakeTest<HttpRedirectTest>

View File

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

View File

@@ -2,10 +2,12 @@ import go
import TestUtilities.InlineExpectationsTest
import experimental.frameworks.CleverGo
module HttpResponseBodyTest implements TestSig {
string getARelevantTag() { result = ["contentType", "responseBody"] }
class HttpResponseBodyTest extends InlineExpectationsTest {
HttpResponseBodyTest() { this = "HttpResponseBodyTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = ["contentType", "responseBody"] }
override 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
@@ -21,5 +23,3 @@ module HttpResponseBodyTest implements TestSig {
)
}
}
import MakeTest<HttpResponseBodyTest>

View File

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

View File

@@ -14,10 +14,12 @@ class Configuration extends TaintTracking::Configuration {
}
}
module TaintTrackingTest implements TestSig {
string getARelevantTag() { result = "taintSink" }
class TaintTrackingTest extends InlineExpectationsTest {
TaintTrackingTest() { this = "TaintTrackingTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "taintSink" }
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
@@ -27,5 +29,3 @@ module TaintTrackingTest implements TestSig {
)
}
}
import MakeTest<TaintTrackingTest>

View File

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

View File

@@ -2,10 +2,12 @@ import go
import TestUtilities.InlineExpectationsTest
import experimental.frameworks.CleverGo
module UntrustedFlowSourceTest implements TestSig {
string getARelevantTag() { result = "untrustedFlowSource" }
class UntrustedFlowSourceTest extends InlineExpectationsTest {
UntrustedFlowSourceTest() { this = "UntrustedFlowSourceTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "untrustedFlowSource" }
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
@@ -19,5 +21,3 @@ module UntrustedFlowSourceTest implements TestSig {
)
}
}
import MakeTest<UntrustedFlowSourceTest>

View File

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

View File

@@ -2,10 +2,14 @@ import go
import TestUtilities.InlineExpectationsTest
import experimental.frameworks.Fiber
module HttpHeaderWriteTest implements TestSig {
string getARelevantTag() { result = ["headerKeyNode", "headerValNode", "headerKey", "headerVal"] }
class HttpHeaderWriteTest extends InlineExpectationsTest {
HttpHeaderWriteTest() { this = "HttpHeaderWriteTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() {
result = ["headerKeyNode", "headerValNode", "headerKey", "headerVal"]
}
override 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(),
@@ -52,5 +56,3 @@ module HttpHeaderWriteTest implements TestSig {
)
}
}
import MakeTest<HttpHeaderWriteTest>

View File

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

View File

@@ -2,10 +2,12 @@ import go
import TestUtilities.InlineExpectationsTest
import experimental.frameworks.Fiber
module HttpRedirectTest implements TestSig {
string getARelevantTag() { result = "redirectUrl" }
class HttpRedirectTest extends InlineExpectationsTest {
HttpRedirectTest() { this = "HttpRedirectTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "redirectUrl" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "redirectUrl" and
exists(Http::Redirect rd |
rd.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
@@ -15,5 +17,3 @@ module HttpRedirectTest implements TestSig {
)
}
}
import MakeTest<HttpRedirectTest>

View File

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

View File

@@ -2,10 +2,12 @@ import go
import TestUtilities.InlineExpectationsTest
import experimental.frameworks.Fiber
module HttpResponseBodyTest implements TestSig {
string getARelevantTag() { result = ["contentType", "responseBody"] }
class HttpResponseBodyTest extends InlineExpectationsTest {
HttpResponseBodyTest() { this = "HttpResponseBodyTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = ["contentType", "responseBody"] }
override 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
@@ -21,5 +23,3 @@ module HttpResponseBodyTest implements TestSig {
)
}
}
import MakeTest<HttpResponseBodyTest>

View File

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

View File

@@ -14,10 +14,12 @@ class Configuration extends TaintTracking::Configuration {
}
}
module TaintTrackingTest implements TestSig {
string getARelevantTag() { result = "taintSink" }
class TaintTrackingTest extends InlineExpectationsTest {
TaintTrackingTest() { this = "TaintTrackingTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "taintSink" }
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
@@ -27,5 +29,3 @@ module TaintTrackingTest implements TestSig {
)
}
}
import MakeTest<TaintTrackingTest>

View File

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

View File

@@ -2,10 +2,12 @@ import go
import TestUtilities.InlineExpectationsTest
import experimental.frameworks.Fiber
module UntrustedFlowSourceTest implements TestSig {
string getARelevantTag() { result = "untrustedFlowSource" }
class UntrustedFlowSourceTest extends InlineExpectationsTest {
UntrustedFlowSourceTest() { this = "UntrustedFlowSourceTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "untrustedFlowSource" }
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
@@ -19,5 +21,3 @@ module UntrustedFlowSourceTest implements TestSig {
)
}
}
import MakeTest<UntrustedFlowSourceTest>

View File

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

View File

@@ -1,10 +1,12 @@
import go
import TestUtilities.InlineExpectationsTest
module FunctionIsVariadicTest implements TestSig {
string getARelevantTag() { result = "isVariadic" }
class FunctionIsVariadicTest extends InlineExpectationsTest {
FunctionIsVariadicTest() { this = "Function::IsVariadicTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "isVariadic" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(CallExpr ce |
ce.getTarget().isVariadic() and
ce.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
@@ -15,5 +17,3 @@ module FunctionIsVariadicTest implements TestSig {
)
}
}
import MakeTest<FunctionIsVariadicTest>

View File

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

View File

@@ -1,10 +1,12 @@
import go
import TestUtilities.InlineExpectationsTest
module ImplementsComparableTest implements TestSig {
string getARelevantTag() { result = "implementsComparable" }
class ImplementsComparableTest extends InlineExpectationsTest {
ImplementsComparableTest() { this = "ImplementsComparableTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "implementsComparable" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
// file = "interface.go" and
tag = "implementsComparable" and
exists(TypeSpec ts |
@@ -18,5 +20,3 @@ module ImplementsComparableTest implements TestSig {
)
}
}
import MakeTest<ImplementsComparableTest>

View File

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

View File

@@ -1,10 +1,12 @@
import go
import TestUtilities.InlineExpectationsTest
module SignatureTypeIsVariadicTest implements TestSig {
string getARelevantTag() { result = "isVariadic" }
class SignatureTypeIsVariadicTest extends InlineExpectationsTest {
SignatureTypeIsVariadicTest() { this = "SignatureType::IsVariadicTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "isVariadic" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(FuncDef fd |
fd.isVariadic() and
fd.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
@@ -15,5 +17,3 @@ module SignatureTypeIsVariadicTest implements TestSig {
)
}
}
import MakeTest<SignatureTypeIsVariadicTest>

View File

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

View File

@@ -1,10 +1,12 @@
import go
import TestUtilities.InlineExpectationsTest
module HttpHandler implements TestSig {
string getARelevantTag() { result = "handler" }
class HttpHandler extends InlineExpectationsTest {
HttpHandler() { this = "httphandler" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "handler" }
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()
@@ -15,5 +17,3 @@ module HttpHandler implements TestSig {
)
}
}
import MakeTest<HttpHandler>

View File

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

View File

@@ -1,10 +1,12 @@
import go
import TestUtilities.InlineExpectationsTest
module LoggerTest implements TestSig {
string getARelevantTag() { result = "logger" }
class LoggerTest extends InlineExpectationsTest {
LoggerTest() { this = "LoggerTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "logger" }
override 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
@@ -14,5 +16,3 @@ module LoggerTest implements TestSig {
)
}
}
import MakeTest<LoggerTest>

View File

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

View File

@@ -13,10 +13,12 @@ class DataConfiguration extends DataFlow::Configuration {
}
}
module DataFlowTest implements TestSig {
string getARelevantTag() { result = "dataflow" }
class DataFlowTest extends InlineExpectationsTest {
DataFlowTest() { this = "DataFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "dataflow" }
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
@@ -39,10 +41,12 @@ class TaintConfiguration extends TaintTracking::Configuration {
}
}
module TaintFlowTest implements TestSig {
string getARelevantTag() { result = "taintflow" }
class TaintFlowTest extends InlineExpectationsTest {
TaintFlowTest() { this = "TaintFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "taintflow" }
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
@@ -52,5 +56,3 @@ module TaintFlowTest implements TestSig {
)
}
}
import MakeTest<MergeTests<DataFlowTest, TaintFlowTest>>

View File

@@ -1,3 +1,2 @@
failures
invalidModelRow
testFailures

View File

@@ -15,10 +15,12 @@ class DataConfiguration extends DataFlow::Configuration {
}
}
module DataFlowTest implements TestSig {
string getARelevantTag() { result = "dataflow" }
class DataFlowTest extends InlineExpectationsTest {
DataFlowTest() { this = "DataFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "dataflow" }
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
@@ -41,10 +43,12 @@ class TaintConfiguration extends TaintTracking::Configuration {
}
}
module TaintFlowTest implements TestSig {
string getARelevantTag() { result = "taintflow" }
class TaintFlowTest extends InlineExpectationsTest {
TaintFlowTest() { this = "TaintFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "taintflow" }
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
@@ -54,5 +58,3 @@ module TaintFlowTest implements TestSig {
)
}
}
import MakeTest<MergeTests<DataFlowTest, TaintFlowTest>>

View File

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

View File

@@ -23,10 +23,12 @@ class TestConfig extends DataFlow::Configuration {
}
}
module DataFlowTest implements TestSig {
string getARelevantTag() { result = "dataflow" }
class DataFlowTest extends InlineExpectationsTest {
DataFlowTest() { this = "DataFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "dataflow" }
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
@@ -36,5 +38,3 @@ module DataFlowTest implements TestSig {
)
}
}
import MakeTest<DataFlowTest>

View File

@@ -13,10 +13,12 @@ class TestConfig extends TaintTracking::Configuration {
}
}
module DataFlowTest implements TestSig {
string getARelevantTag() { result = "dataflow" }
class DataFlowTest extends InlineExpectationsTest {
DataFlowTest() { this = "DataFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "dataflow" }
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
@@ -26,5 +28,3 @@ module DataFlowTest implements TestSig {
)
}
}
import MakeTest<DataFlowTest>

View File

@@ -21,10 +21,12 @@ class TestConfig extends DataFlow::Configuration {
}
}
module PromotedFieldsTest implements TestSig {
string getARelevantTag() { result = "promotedfields" }
class PromotedFieldsTest extends InlineExpectationsTest {
PromotedFieldsTest() { this = "PromotedFieldsTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "promotedfields" }
override 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(),
@@ -35,5 +37,3 @@ module PromotedFieldsTest implements TestSig {
)
}
}
import MakeTest<PromotedFieldsTest>

View File

@@ -21,10 +21,12 @@ class TestConfig extends DataFlow::Configuration {
}
}
module PromotedMethodsTest implements TestSig {
string getARelevantTag() { result = "promotedmethods" }
class PromotedMethodsTest extends InlineExpectationsTest {
PromotedMethodsTest() { this = "PromotedMethodsTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "promotedmethods" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(TestConfig config, DataFlow::Node source, DataFlow::Node sink |
config.hasFlow(source, sink)
|
@@ -36,5 +38,3 @@ module PromotedMethodsTest implements TestSig {
)
}
}
import MakeTest<PromotedMethodsTest>

View File

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

View File

@@ -13,10 +13,12 @@ class Configuration extends DataFlow::Configuration {
}
}
module DataFlowTest implements TestSig {
string getARelevantTag() { result = "dataflow" }
class DataFlowTest extends InlineExpectationsTest {
DataFlowTest() { this = "DataFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "dataflow" }
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
@@ -26,5 +28,3 @@ module DataFlowTest implements TestSig {
)
}
}
import MakeTest<DataFlowTest>

View File

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

View File

@@ -13,10 +13,12 @@ class DataConfiguration extends DataFlow::Configuration {
}
}
module DataFlowTest implements TestSig {
string getARelevantTag() { result = "dataflow" }
class DataFlowTest extends InlineExpectationsTest {
DataFlowTest() { this = "DataFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "dataflow" }
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
@@ -39,10 +41,12 @@ class TaintConfiguration extends TaintTracking::Configuration {
}
}
module TaintFlowTest implements TestSig {
string getARelevantTag() { result = "taintflow" }
class TaintFlowTest extends InlineExpectationsTest {
TaintFlowTest() { this = "TaintFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "taintflow" }
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
@@ -52,5 +56,3 @@ module TaintFlowTest implements TestSig {
)
}
}
import MakeTest<MergeTests<DataFlowTest, TaintFlowTest>>

View File

@@ -1,3 +1,2 @@
failures
invalidModelRow
testFailures

View File

@@ -43,10 +43,12 @@ class DataConfiguration extends DataFlow::Configuration {
}
}
module DataFlowTest implements TestSig {
string getARelevantTag() { result = "dataflow" }
class DataFlowTest extends InlineExpectationsTest {
DataFlowTest() { this = "DataFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "dataflow" }
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
@@ -69,10 +71,12 @@ class TaintConfiguration extends TaintTracking::Configuration {
}
}
module TaintFlowTest implements TestSig {
string getARelevantTag() { result = "taintflow" }
class TaintFlowTest extends InlineExpectationsTest {
TaintFlowTest() { this = "TaintFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "taintflow" }
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
@@ -82,5 +86,9 @@ module TaintFlowTest implements TestSig {
)
}
}
import MakeTest<MergeTests<DataFlowTest, TaintFlowTest>>
// from TaintConfiguration cfg, DataFlow::PartialPathNode source, DataFlow::PartialPathNode sink
// where
// cfg.hasPartialFlow(source, sink, _)
// and
// source.getNode().hasLocationInfo(_, 22, _, _, _)
// select sink, source, sink, "Partial flow from unsanitized user data"

View File

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

View File

@@ -2,10 +2,12 @@ import go
import TestUtilities.InlineExpectationsTest
import semmle.go.security.SqlInjection
module SqlInjectionTest implements TestSig {
string getARelevantTag() { result = "sqlinjection" }
class SqlInjectionTest extends InlineExpectationsTest {
SqlInjectionTest() { this = "SqlInjectionTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "sqlinjection" }
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
@@ -15,5 +17,3 @@ module SqlInjectionTest implements TestSig {
)
}
}
import MakeTest<SqlInjectionTest>

View File

@@ -16,10 +16,12 @@ class Configuration extends TaintTracking::Configuration {
}
}
module TaintFlowTest implements TestSig {
string getARelevantTag() { result = "taintflow" }
class TaintFlowTest extends InlineExpectationsTest {
TaintFlowTest() { this = "TaintFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "taintflow" }
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
@@ -29,5 +31,3 @@ module TaintFlowTest implements TestSig {
)
}
}
import MakeTest<TaintFlowTest>

View File

@@ -2,10 +2,12 @@ import go
import semmle.go.frameworks.GoKit
import TestUtilities.InlineExpectationsTest
module UntrustedFlowSourceTest implements TestSig {
string getARelevantTag() { result = "source" }
class UntrustedFlowSourceTest extends InlineExpectationsTest {
UntrustedFlowSourceTest() { this = "untrustedflowsourcetest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "source" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(UntrustedFlowSource source |
source
.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
@@ -16,5 +18,3 @@ module UntrustedFlowSourceTest implements TestSig {
)
}
}
import MakeTest<UntrustedFlowSourceTest>

View File

@@ -21,10 +21,12 @@ class TestConfig extends TaintTracking::Configuration {
}
}
module K8sIoApiCoreV1Test implements TestSig {
string getARelevantTag() { result = "KsIoApiCoreV" }
class K8sIoApiCoreV1Test extends InlineExpectationsTest {
K8sIoApiCoreV1Test() { this = "K8sIoApiCoreV1Test" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "KsIoApiCoreV" }
override 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(),
@@ -35,5 +37,3 @@ module K8sIoApiCoreV1Test implements TestSig {
)
}
}
import MakeTest<K8sIoApiCoreV1Test>

View File

@@ -21,10 +21,12 @@ class TestConfig extends TaintTracking::Configuration {
}
}
module K8sIoApimachineryPkgRuntimeTest implements TestSig {
string getARelevantTag() { result = "KsIoApimachineryPkgRuntime" }
class K8sIoApimachineryPkgRuntimeTest extends InlineExpectationsTest {
K8sIoApimachineryPkgRuntimeTest() { this = "KsIoApimachineryPkgRuntimeTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "KsIoApimachineryPkgRuntime" }
override 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(),
@@ -35,5 +37,3 @@ module K8sIoApimachineryPkgRuntimeTest implements TestSig {
)
}
}
import MakeTest<K8sIoApimachineryPkgRuntimeTest>

View File

@@ -1,10 +1,12 @@
import go
import TestUtilities.InlineExpectationsTest
module K8sIoApimachineryPkgRuntimeTest implements TestSig {
string getARelevantTag() { result = "KsIoClientGo" }
class K8sIoApimachineryPkgRuntimeTest extends InlineExpectationsTest {
K8sIoApimachineryPkgRuntimeTest() { this = "KsIoClientGoTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "KsIoClientGo" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(K8sIoClientGo::SecretInterfaceSource source |
source
.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
@@ -15,5 +17,3 @@ module K8sIoApimachineryPkgRuntimeTest implements TestSig {
)
}
}
import MakeTest<K8sIoApimachineryPkgRuntimeTest>

View File

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

View File

@@ -1,10 +1,12 @@
import go
import TestUtilities.InlineExpectationsTest
module NoSqlQueryTest implements TestSig {
string getARelevantTag() { result = "nosqlquery" }
class NoSqlQueryTest extends InlineExpectationsTest {
NoSqlQueryTest() { this = "NoSQLQueryTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "nosqlquery" }
override 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
@@ -14,5 +16,3 @@ module NoSqlQueryTest implements TestSig {
)
}
}
import MakeTest<NoSqlQueryTest>

View File

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

View File

@@ -15,10 +15,12 @@ class TestConfig extends TaintTracking::Configuration {
override predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
}
module MissingDataFlowTest implements TestSig {
string getARelevantTag() { result = "noflow" }
class MissingDataFlowTest extends InlineExpectationsTest {
MissingDataFlowTest() { this = "MissingDataFlow" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "noflow" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "noflow" and
value = "" and
exists(Sink sink |
@@ -30,10 +32,12 @@ module MissingDataFlowTest implements TestSig {
}
}
module HttpResponseBodyTest implements TestSig {
string getARelevantTag() { result = "responsebody" }
class HttpResponseBodyTest extends InlineExpectationsTest {
HttpResponseBodyTest() { this = "HttpResponseBodyTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "responsebody" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "responsebody" and
exists(Http::ResponseBody rb |
rb.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
@@ -43,5 +47,3 @@ module HttpResponseBodyTest implements TestSig {
)
}
}
import MakeTest<MergeTests<MissingDataFlowTest, HttpResponseBodyTest>>

View File

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

View File

@@ -1,10 +1,12 @@
import go
import TestUtilities.InlineExpectationsTest
module FileSystemAccessTest implements TestSig {
string getARelevantTag() { result = "fsaccess" }
class FileSystemAccessTest extends InlineExpectationsTest {
FileSystemAccessTest() { this = "FileSystemAccess" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "fsaccess" }
override 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
@@ -14,5 +16,3 @@ module FileSystemAccessTest implements TestSig {
)
}
}
import MakeTest<FileSystemAccessTest>

View File

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

View File

@@ -13,10 +13,12 @@ class TestConfig extends TaintTracking::Configuration {
}
}
module ZapTest implements TestSig {
string getARelevantTag() { result = "zap" }
class ZapTest extends InlineExpectationsTest {
ZapTest() { this = "ZapTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "zap" }
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
@@ -26,5 +28,3 @@ module ZapTest implements TestSig {
)
}
}
import MakeTest<ZapTest>

View File

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

View File

@@ -2,10 +2,12 @@ import go
import TestUtilities.InlineExpectationsTest
import semmle.go.security.IncorrectIntegerConversionLib
module TestIncorrectIntegerConversion implements TestSig {
string getARelevantTag() { result = "hasValueFlow" }
class TestIncorrectIntegerConversion extends InlineExpectationsTest {
TestIncorrectIntegerConversion() { this = "TestIncorrectIntegerConversion" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "hasValueFlow" }
override 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
@@ -19,5 +21,3 @@ module TestIncorrectIntegerConversion implements TestSig {
)
}
}
import MakeTest<TestIncorrectIntegerConversion>

View File

@@ -19,10 +19,12 @@ module Config implements DataFlow::ConfigSig {
module Flow = TaintTracking::Global<Config>;
module InlineFlowTest implements TestSig {
string getARelevantTag() { result = "flow" }
class InlineFlowTest extends InlineExpectationsTest {
InlineFlowTest() { this = "HasFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "flow" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "flow" and
exists(DataFlow::Node sink | Flow::flowTo(sink) |
sink.getLocation() = location and
@@ -31,5 +33,3 @@ module InlineFlowTest implements TestSig {
)
}
}
import MakeTest<InlineFlowTest>

View File

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

View File

@@ -12,10 +12,12 @@ module Config implements DataFlow::ConfigSig {
module Flow = DataFlow::Global<Config>;
module HasFlowTest implements TestSig {
string getARelevantTag() { result = "flow" }
class HasFlowTest extends InlineExpectationsTest {
HasFlowTest() { this = "HasFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "flow" }
override 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
@@ -24,5 +26,3 @@ module HasFlowTest implements TestSig {
)
}
}
import MakeTest<HasFlowTest>

View File

@@ -18,10 +18,12 @@ module TaintFlowConfig implements DataFlow::ConfigSig {
module TaintFlow = TaintTracking::Global<TaintFlowConfig>;
module HasFlowTest implements TestSig {
string getARelevantTag() { result = "hasTaintFlow" }
class HasFlowTest extends InlineExpectationsTest {
HasFlowTest() { this = "HasFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = ["hasTaintFlow"] }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasTaintFlow" and
exists(DataFlow::Node sink | TaintFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -30,5 +32,3 @@ module HasFlowTest implements TestSig {
)
}
}
import MakeTest<HasFlowTest>

View File

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

View File

@@ -59,10 +59,12 @@ module Flow = TaintTracking::GlobalWithState<Config>;
module PartialFlow = Flow::FlowExploration<explorationLimit/0>;
module HasFlowTest implements TestSig {
string getARelevantTag() { result = ["pFwd", "pRev", "flow"] }
class HasFlowTest extends InlineExpectationsTest {
HasFlowTest() { this = "HasFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = ["pFwd", "pRev", "flow"] }
override 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
@@ -90,5 +92,3 @@ module HasFlowTest implements TestSig {
)
}
}
import MakeTest<HasFlowTest>

View File

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

View File

@@ -26,10 +26,12 @@ module LocalTaintConfig implements DataFlow::ConfigSig {
module LocalTaintFlow = TaintTracking::Global<LocalTaintConfig>;
module LocalFlowTest implements TestSig {
string getARelevantTag() { result = ["hasLocalValueFlow", "hasLocalTaintFlow"] }
class LocalFlowTest extends InlineExpectationsTest {
LocalFlowTest() { this = "LocalFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = ["hasLocalValueFlow", "hasLocalTaintFlow"] }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasLocalValueFlow" and
exists(DataFlow::Node sink | LocalValueFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -47,5 +49,3 @@ module LocalFlowTest implements TestSig {
)
}
}
import MakeTest<LocalFlowTest>

View File

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

View File

@@ -22,10 +22,12 @@ module RemoteTaintConfig implements DataFlow::ConfigSig {
module RemoteTaintFlow = TaintTracking::Global<RemoteTaintConfig>;
module RemoteFlowTest implements TestSig {
string getARelevantTag() { result = ["hasRemoteValueFlow", "hasRemoteTaintFlow"] }
class RemoteFlowTest extends InlineExpectationsTest {
RemoteFlowTest() { this = "RemoteFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = ["hasRemoteValueFlow", "hasRemoteTaintFlow"] }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasRemoteValueFlow" and
exists(DataFlow::Node sink | RemoteValueFlow::flowTo(sink) |
sink.getLocation() = location and
@@ -43,5 +45,3 @@ module RemoteFlowTest implements TestSig {
)
}
}
import MakeTest<RemoteFlowTest>

View File

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

View File

@@ -3,8 +3,10 @@ import semmle.code.java.frameworks.JaxWS
import semmle.code.java.security.XSS
import TestUtilities.InlineExpectationsTest
module JaxRsTest implements TestSig {
string getARelevantTag() {
class JaxRsTest extends InlineExpectationsTest {
JaxRsTest() { this = "JaxRsTest" }
override string getARelevantTag() {
result =
[
"ResourceMethod", "RootResourceClass", "NonRootResourceClass",
@@ -16,7 +18,7 @@ module JaxRsTest implements TestSig {
]
}
predicate hasActualResult(Location location, string element, string tag, string value) {
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "ResourceMethod" and
exists(JaxRsResourceMethod resourceMethod |
resourceMethod.getLocation() = location and
@@ -166,5 +168,3 @@ module JaxRsTest implements TestSig {
)
}
}
import MakeTest<JaxRsTest>

View File

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

View File

@@ -2,10 +2,12 @@ import java
import semmle.code.java.frameworks.JaxWS
import TestUtilities.InlineExpectationsTest
module JaxWsEndpointTest implements TestSig {
string getARelevantTag() { result = ["JaxWsEndpoint", "JaxWsEndpointRemoteMethod"] }
class JaxWsEndpointTest extends InlineExpectationsTest {
JaxWsEndpointTest() { this = "JaxWsEndpointTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = ["JaxWsEndpoint", "JaxWsEndpointRemoteMethod"] }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "JaxWsEndpoint" and
exists(JaxWsEndpoint jaxWsEndpoint |
jaxWsEndpoint.getLocation() = location and
@@ -23,5 +25,3 @@ module JaxWsEndpointTest implements TestSig {
)
}
}
import MakeTest<JaxWsEndpointTest>

View File

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

View File

@@ -14,10 +14,12 @@ module Config implements DataFlow::ConfigSig {
module Flow = TaintTracking::Global<Config>;
module FlowStepTest implements TestSig {
string getARelevantTag() { result = "taintReachesReturn" }
class FlowStepTest extends InlineExpectationsTest {
FlowStepTest() { this = "FlowStepTest" }
predicate hasActualResult(Location l, string element, string tag, string value) {
override string getARelevantTag() { result = "taintReachesReturn" }
override predicate hasActualResult(Location l, string element, string tag, string value) {
tag = "taintReachesReturn" and
value = "" and
exists(DataFlow::Node source | Flow::flow(source, _) |
@@ -26,5 +28,3 @@ module FlowStepTest implements TestSig {
)
}
}
import MakeTest<FlowStepTest>

View File

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

View File

@@ -14,10 +14,12 @@ module Config implements DataFlow::ConfigSig {
module Flow = TaintTracking::Global<Config>;
module SinkTest implements TestSig {
string getARelevantTag() { result = "taintReachesSink" }
class SinkTest extends InlineExpectationsTest {
SinkTest() { this = "SinkTest" }
predicate hasActualResult(Location l, string element, string tag, string value) {
override string getARelevantTag() { result = "taintReachesSink" }
override predicate hasActualResult(Location l, string element, string tag, string value) {
tag = "taintReachesSink" and
value = "" and
exists(DataFlow::Node source | Flow::flow(source, _) |
@@ -26,5 +28,3 @@ module SinkTest implements TestSig {
)
}
}
import MakeTest<SinkTest>

View File

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

View File

@@ -24,10 +24,12 @@ module ValueFlowConfig implements DataFlow::ConfigSig {
module ValueFlow = DataFlow::Global<ValueFlowConfig>;
module HasFlowTest implements TestSig {
string getARelevantTag() { result = ["numTaintFlow", "numValueFlow"] }
class HasFlowTest extends InlineExpectationsTest {
HasFlowTest() { this = "HasFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = ["numTaintFlow", "numValueFlow"] }
override 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
@@ -46,5 +48,3 @@ module HasFlowTest implements TestSig {
)
}
}
import MakeTest<HasFlowTest>

View File

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

View File

@@ -14,15 +14,15 @@ module TestConfig implements DataFlow::ConfigSig {
module TestFlow = TaintTracking::Global<TestConfig>;
module JmsFlowTest implements TestSig {
string getARelevantTag() { result = "tainted" }
class JmsFlowTest extends InlineExpectationsTest {
JmsFlowTest() { this = "JmsFlowTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "tainted" }
override 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

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

View File

@@ -2,15 +2,15 @@ import java
import semmle.code.java.dataflow.FlowSources
import TestUtilities.InlineExpectationsTest
module JmsRemoteSourcesTest implements TestSig {
string getARelevantTag() { result = "source" }
class JmsRemoteSourcesTest extends InlineExpectationsTest {
JmsRemoteSourcesTest() { this = "JmsRemoteSourcesTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "source" }
override 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

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

View File

@@ -2,10 +2,12 @@ import java
import semmle.code.java.dataflow.FlowSources
import TestUtilities.InlineExpectationsTest
module SourceTest implements TestSig {
string getARelevantTag() { result = "source" }
class SourceTest extends InlineExpectationsTest {
SourceTest() { this = "SourceTest" }
predicate hasActualResult(Location location, string element, string tag, string value) {
override string getARelevantTag() { result = "source" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "source" and
exists(RemoteFlowSource source |
not source.asParameter().getCallable().getDeclaringType().hasName("DefaultConsumer") and
@@ -15,5 +17,3 @@ module SourceTest implements TestSig {
)
}
}
import MakeTest<SourceTest>

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