Files
codeql/ruby/ql/test/query-tests/experimental/improper-memoization/ImproperMemoization.ql
2022-10-27 09:12:06 +02:00

24 lines
708 B
Plaintext

import codeql.ruby.AST
import TestUtilities.InlineExpectationsTest
import codeql.ruby.security.ImproperMemoizationQuery
class ImproperMemoizationTest extends InlineExpectationsTest {
ImproperMemoizationTest() { this = "ImproperMemoizationTest" }
override string getARelevantTag() { result = "result" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "result" and
value = "BAD" and
exists(Expr e |
isImproperMemoizationMethod(e, _, _) and
location = e.getLocation() and
element = e.toString()
)
}
}
from Method m, Parameter p, AssignLogicalOrExpr s
where isImproperMemoizationMethod(m, p, s)
select m, p, s