зеркало из https://github.com/github/codeql.git
Swift: Rewrite inline expectation tests to use the parameterized module
This commit is contained in:
Родитель
2276890cec
Коммит
3a3d9bc505
|
@ -0,0 +1,2 @@
|
|||
failures
|
||||
testFailures
|
|
@ -2,12 +2,10 @@ import swift
|
|||
import FlowConfig
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class TaintTest extends InlineExpectationsTest {
|
||||
TaintTest() { this = "DataFlowTest" }
|
||||
module TaintTest implements TestSig {
|
||||
string getARelevantTag() { result = "flow" }
|
||||
|
||||
override string getARelevantTag() { result = "flow" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(DataFlow::Node source, DataFlow::Node sink, Expr sinkExpr |
|
||||
TestFlow::flow(source, sink) and
|
||||
sinkExpr = sink.asExpr() and
|
||||
|
@ -18,3 +16,5 @@ class TaintTest extends InlineExpectationsTest {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<TaintTest>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
failures
|
||||
testFailures
|
|
@ -8,12 +8,10 @@ string describe(FlowSource source) {
|
|||
source instanceof LocalFlowSource and result = "local"
|
||||
}
|
||||
|
||||
class FlowSourcesTest extends InlineExpectationsTest {
|
||||
FlowSourcesTest() { this = "FlowSourcesTest" }
|
||||
module FlowSourcesTest 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(FlowSource source |
|
||||
location = source.getLocation() and
|
||||
location.getFile().getBaseName() != "" and
|
||||
|
@ -23,3 +21,5 @@ class FlowSourcesTest extends InlineExpectationsTest {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<FlowSourcesTest>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
failures
|
||||
testFailures
|
|
@ -2,12 +2,10 @@ import swift
|
|||
import Taint
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class TaintTest extends InlineExpectationsTest {
|
||||
TaintTest() { this = "TaintTest" }
|
||||
module TaintTest implements TestSig {
|
||||
string getARelevantTag() { result = "tainted" }
|
||||
|
||||
override string getARelevantTag() { result = "tainted" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(DataFlow::Node source, DataFlow::Node sink, Expr sinkExpr |
|
||||
TestFlow::flow(source, sink) and
|
||||
sinkExpr = sink.asExpr() and
|
||||
|
@ -18,3 +16,5 @@ class TaintTest extends InlineExpectationsTest {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<TaintTest>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
failures
|
||||
testFailures
|
|
@ -2,12 +2,10 @@ import swift
|
|||
import Taint
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class TaintTest extends InlineExpectationsTest {
|
||||
TaintTest() { this = "TaintTest" }
|
||||
module TaintTest implements TestSig {
|
||||
string getARelevantTag() { result = "tainted" }
|
||||
|
||||
override string getARelevantTag() { result = "tainted" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(DataFlow::Node source, DataFlow::Node sink, Expr sinkExpr |
|
||||
TestFlow::flow(source, sink) and
|
||||
sinkExpr = sink.asExpr() and
|
||||
|
@ -18,3 +16,5 @@ class TaintTest extends InlineExpectationsTest {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<TaintTest>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
failures
|
||||
testFailures
|
|
@ -4,12 +4,10 @@ import codeql.swift.dataflow.FlowSources
|
|||
import codeql.swift.security.PathInjectionQuery
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class PathInjectionTest extends InlineExpectationsTest {
|
||||
PathInjectionTest() { this = "PathInjectionTest" }
|
||||
module PathInjectionTest implements TestSig {
|
||||
string getARelevantTag() { result = "hasPathInjection" }
|
||||
|
||||
override string getARelevantTag() { result = "hasPathInjection" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(DataFlow::Node source, DataFlow::Node sink |
|
||||
PathInjectionFlow::flow(source, sink) and
|
||||
location = sink.getLocation() and
|
||||
|
@ -20,3 +18,5 @@ class PathInjectionTest extends InlineExpectationsTest {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<PathInjectionTest>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
failures
|
||||
testFailures
|
|
@ -3,12 +3,10 @@ import codeql.swift.dataflow.DataFlow
|
|||
import codeql.swift.security.CleartextLoggingQuery
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class CleartextLogging extends InlineExpectationsTest {
|
||||
CleartextLogging() { this = "CleartextLogging" }
|
||||
module CleartextLogging implements TestSig {
|
||||
string getARelevantTag() { result = "hasCleartextLogging" }
|
||||
|
||||
override string getARelevantTag() { result = "hasCleartextLogging" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(DataFlow::Node source, DataFlow::Node sink, Expr sinkExpr |
|
||||
CleartextLoggingFlow::flow(source, sink) and
|
||||
sinkExpr = sink.asExpr() and
|
||||
|
@ -19,3 +17,5 @@ class CleartextLogging extends InlineExpectationsTest {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<CleartextLogging>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
failures
|
||||
testFailures
|
|
@ -9,12 +9,10 @@ class TestRemoteSource extends RemoteFlowSource {
|
|||
override string getSourceType() { result = "Test source" }
|
||||
}
|
||||
|
||||
class XxeTest extends InlineExpectationsTest {
|
||||
XxeTest() { this = "XxeTest" }
|
||||
module XxeTest implements TestSig {
|
||||
string getARelevantTag() { result = "hasXXE" }
|
||||
|
||||
override string getARelevantTag() { result = "hasXXE" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(DataFlow::Node source, DataFlow::Node sink, Expr sinkExpr |
|
||||
XxeFlow::flow(source, sink) and
|
||||
sinkExpr = sink.asExpr() and
|
||||
|
@ -25,3 +23,5 @@ class XxeTest extends InlineExpectationsTest {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<XxeTest>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
failures
|
||||
testFailures
|
|
@ -3,12 +3,10 @@ import codeql.swift.dataflow.DataFlow
|
|||
import codeql.swift.security.PredicateInjectionQuery
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class PredicateInjectionTest extends InlineExpectationsTest {
|
||||
PredicateInjectionTest() { this = "PredicateInjectionTest" }
|
||||
module PredicateInjectionTest implements TestSig {
|
||||
string getARelevantTag() { result = "hasPredicateInjection" }
|
||||
|
||||
override string getARelevantTag() { result = "hasPredicateInjection" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(DataFlow::Node source, DataFlow::Node sink, Expr sinkExpr |
|
||||
PredicateInjectionFlow::flow(source, sink) and
|
||||
sinkExpr = sink.asExpr() and
|
||||
|
@ -19,3 +17,5 @@ class PredicateInjectionTest extends InlineExpectationsTest {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<PredicateInjectionTest>
|
||||
|
|
Загрузка…
Ссылка в новой задаче