Skip to content

Commit 457a840

Browse files
committed
Ruby: Narrow memo method candidates earlier
1 parent ef6f0e5 commit 457a840

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ruby/ql/lib/codeql/ruby/security/ImproperMemoizationQuery.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ private predicate memoReturnedFromMethod(Method m, MemoStmt s) {
7979
* This can cause stale or incorrect values to be returned when the method is called with different arguments.
8080
*/
8181
predicate isImproperMemoizationMethod(Method m, Parameter p, AssignLogicalOrExpr s) {
82+
m instanceof MemoCandidate and
8283
m.getName() != "initialize" and
8384
parameterUsedInMemoValue(m, p, s) and
8485
not parameterUsedInMemoKey(m, p, s) and

0 commit comments

Comments
 (0)