Skip to content

Commit 10d19bf

Browse files
committed
Temporarily disable operation call resolution
1 parent 5219b1a commit 10d19bf

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

ql/lib/codeql/ruby/dataflow/internal/DataFlowDispatch.qll

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -180,38 +180,42 @@ private module Cached {
180180

181181
cached
182182
CfgScope getTarget(CfgNodes::ExprNodes::CallCfgNode call) {
183-
exists(string method |
184-
exists(Module tp |
185-
instanceMethodCall(call, tp, method) and
186-
result = lookupMethod(tp, method) and
187-
if result.(Method).isPrivate()
188-
then
189-
exists(Self self |
190-
self = call.getReceiver().getExpr() and
191-
pragma[only_bind_out](self.getEnclosingModule().getModule().getSuperClass*()) =
192-
pragma[only_bind_out](result.getEnclosingModule().getModule())
193-
) and
194-
// For now, we restrict the scope of top-level declarations to their file.
195-
// This may remove some plausible targets, but also removes a lot of
196-
// implausible targets
197-
if result.getEnclosingModule() instanceof Toplevel
198-
then result.getFile() = call.getFile()
183+
// Temporarily disable operation resolution (due to bad performance)
184+
not call.getExpr() instanceof Operation and
185+
(
186+
exists(string method |
187+
exists(Module tp |
188+
instanceMethodCall(call, tp, method) and
189+
result = lookupMethod(tp, method) and
190+
if result.(Method).isPrivate()
191+
then
192+
exists(Self self |
193+
self = call.getReceiver().getExpr() and
194+
pragma[only_bind_out](self.getEnclosingModule().getModule().getSuperClass*()) =
195+
pragma[only_bind_out](result.getEnclosingModule().getModule())
196+
) and
197+
// For now, we restrict the scope of top-level declarations to their file.
198+
// This may remove some plausible targets, but also removes a lot of
199+
// implausible targets
200+
if result.getEnclosingModule() instanceof Toplevel
201+
then result.getFile() = call.getFile()
202+
else any()
199203
else any()
200-
else any()
204+
)
205+
or
206+
exists(DataFlow::LocalSourceNode sourceNode |
207+
methodCall(call, sourceNode, method) and
208+
sourceNode = trackSingletonMethod(result, method)
209+
)
201210
)
202211
or
203-
exists(DataFlow::LocalSourceNode sourceNode |
204-
methodCall(call, sourceNode, method) and
205-
sourceNode = trackSingletonMethod(result, method)
212+
exists(Module superClass, string method |
213+
superCall(call, superClass, method) and
214+
result = lookupMethod(superClass, method)
206215
)
216+
or
217+
result = yieldCall(call)
207218
)
208-
or
209-
exists(Module superClass, string method |
210-
superCall(call, superClass, method) and
211-
result = lookupMethod(superClass, method)
212-
)
213-
or
214-
result = yieldCall(call)
215219
}
216220
}
217221

0 commit comments

Comments
 (0)