mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
Merge pull request #13346 from jketema/inline-2
Update inline expectation tests to use parameterized module
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
failures
|
||||
testFailures
|
||||
| improper_memoization.rb:100:1:104:3 | m14 | Unexpected result: result=BAD |
|
||||
#select
|
||||
| improper_memoization.rb:50:1:55:3 | m7 | improper_memoization.rb:50:8:50:10 | arg | improper_memoization.rb:51:3:53:5 | ... \|\|= ... |
|
||||
|
||||
@@ -2,12 +2,10 @@ import codeql.ruby.AST
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
import codeql.ruby.security.ImproperMemoizationQuery
|
||||
|
||||
class ImproperMemoizationTest extends InlineExpectationsTest {
|
||||
ImproperMemoizationTest() { this = "ImproperMemoizationTest" }
|
||||
module ImproperMemoizationTest implements TestSig {
|
||||
string getARelevantTag() { result = "result" }
|
||||
|
||||
override string getARelevantTag() { result = "result" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "result" and
|
||||
value = "BAD" and
|
||||
exists(Expr e |
|
||||
@@ -18,6 +16,8 @@ class ImproperMemoizationTest extends InlineExpectationsTest {
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<ImproperMemoizationTest>
|
||||
|
||||
from Method m, Parameter p, AssignLogicalOrExpr s
|
||||
where isImproperMemoizationMethod(m, p, s)
|
||||
select m, p, s
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
failures
|
||||
testFailures
|
||||
|
||||
@@ -8,17 +8,17 @@ import codeql.ruby.DataFlow
|
||||
import codeql.ruby.security.IncompleteMultiCharacterSanitizationQuery as Query
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class Test extends InlineExpectationsTest {
|
||||
Test() { this = "IncompleteMultiCharacterSanitizationTest" }
|
||||
module Test implements TestSig {
|
||||
string getARelevantTag() { result = "hasResult" }
|
||||
|
||||
override string getARelevantTag() { result = "hasResult" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "hasResult" and
|
||||
hasResult(location, element, value)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<Test>
|
||||
|
||||
predicate hasResult(Location location, string element, string value) {
|
||||
exists(DataFlow::Node replace, string kind |
|
||||
replace.getLocation() = location and
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
failures
|
||||
testFailures
|
||||
#select
|
||||
| Gemfile:2:8:2:28 | "http://rubygems.org" | Dependency source URL uses the unencrypted protocol HTTP. Use HTTPS instead. |
|
||||
| Gemfile:3:8:3:27 | "ftp://rubygems.org" | Dependency source URL uses the unencrypted protocol FTP. Use FTPS or SFTP instead. |
|
||||
|
||||
@@ -2,12 +2,10 @@ import codeql.ruby.AST
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
import codeql.ruby.security.InsecureDependencyQuery
|
||||
|
||||
class InsecureDependencyTest extends InlineExpectationsTest {
|
||||
InsecureDependencyTest() { this = "InsecureDependencyTest" }
|
||||
module InsecureDependencyTest implements TestSig {
|
||||
string getARelevantTag() { result = "result" }
|
||||
|
||||
override string getARelevantTag() { result = "result" }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
tag = "result" and
|
||||
value = "BAD" and
|
||||
exists(Expr e |
|
||||
@@ -18,6 +16,8 @@ class InsecureDependencyTest extends InlineExpectationsTest {
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<InsecureDependencyTest>
|
||||
|
||||
from Expr url, string msg
|
||||
where insecureDependencyUrl(url, msg)
|
||||
select url, msg
|
||||
|
||||
Reference in New Issue
Block a user