Skip to content

Commit 57d8ba6

Browse files
committed
Use flowsTo
1 parent d2e2901 commit 57d8ba6

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

ql/src/codeql_ruby/ApiGraphs.qll

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,23 +313,26 @@ module API {
313313
// pred = `Rails` part of `Rails::Whatever`
314314
// lbl = `Whatever`
315315
// ref = `Rails::Whatever`
316-
exists(ConstantAccess c |
316+
exists(ConstantAccess c, DataFlow::Node node |
317317
not exists(resolveScopeExpr(c)) and
318-
pred.asExpr().getExpr() = c.getScopeExpr() and
318+
pred.flowsTo(node) and
319+
node.asExpr().getExpr() = c.getScopeExpr() and
319320
lbl = Label::member(c.getName()) and
320321
ref.asExpr().getExpr() = c
321322
)
322323
or
323324
// Calling a method on a node that is a use of `base`
324-
exists(MethodCall call |
325-
pred.asExpr().getExpr() = call.getReceiver() and
325+
exists(MethodCall call, DataFlow::Node node |
326+
pred.flowsTo(node) and
327+
node.asExpr().getExpr() = call.getReceiver() and
326328
lbl = Label::return(call.getMethodName()) and
327329
call.getMethodName() != "new" and
328330
ref.asExpr().getExpr() = call
329331
)
330332
or
331-
exists(MethodCall call |
332-
pred.asExpr().getExpr() = call.getReceiver() and
333+
exists(MethodCall call, DataFlow::Node node |
334+
pred.flowsTo(node) and
335+
node.asExpr().getExpr() = call.getReceiver() and
333336
lbl = Label::instance() and
334337
call.getMethodName() = "new" and
335338
ref.asExpr().getExpr() = call

0 commit comments

Comments
 (0)