Skip to content

Commit 04e80fa

Browse files
committed
Ruby: Use lookupMethod
The hope is that this predicate is already used elsewhere, so its cost is amortized.
1 parent 889d971 commit 04e80fa

File tree

1 file changed

+4
-4
lines changed
  • ruby/ql/lib/codeql/ruby/frameworks/actioncontroller

1 file changed

+4
-4
lines changed

ruby/ql/lib/codeql/ruby/frameworks/actioncontroller/Filters.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ private import codeql.ruby.controlflow.CfgNodes::ExprNodes
99
private import codeql.ruby.DataFlow
1010
private import codeql.ruby.dataflow.internal.DataFlowPrivate as DataFlowPrivate
1111
private import codeql.ruby.ast.internal.Constant
12+
private import codeql.ruby.ast.internal.Module
1213

1314
/**
1415
* Provides modeling for ActionController filters.
@@ -109,7 +110,7 @@ module Filters {
109110
}
110111

111112
/**
112-
* Gets the callable that implements the filter with name `name`.
113+
* Gets the callable that implements a filter registered by this call.
113114
* This currently only finds methods in the local class or superclass.
114115
* It doesn't handle:
115116
* - lambdas
@@ -127,9 +128,8 @@ module Filters {
127128
* ```
128129
*/
129130
Callable getAFilterCallable() {
130-
this.getFilterArgumentName() = result.(MethodBase).getName() and
131-
result.getEnclosingModule().getModule() =
132-
this.getExpr().getEnclosingModule().getModule().getAnAncestor()
131+
result =
132+
lookupMethod(this.getExpr().getEnclosingModule().getModule(), this.getFilterArgumentName())
133133
}
134134
}
135135

0 commit comments

Comments
 (0)