diff --git a/ql/src/codeql_ruby/ast/Call.qll b/ql/src/codeql_ruby/ast/Call.qll index bc2231d94f3..e301a1b5b9d 100644 --- a/ql/src/codeql_ruby/ast/Call.qll +++ b/ql/src/codeql_ruby/ast/Call.qll @@ -162,6 +162,9 @@ private class RegularMethodCall extends MethodCall, TRegularMethodCall { not exists(g.getReceiver()) and toGenerated(result) = g.getMethod().(Generated::ScopeResolution).getScope() or + // If there's no explicit receiver (or scope resolution that acts like a + // receiver), then the receiver is implicitly `self`. N.B. `::Foo()` is + // not valid Ruby. not exists(g.getReceiver()) and not exists(g.getMethod().(Generated::ScopeResolution).getScope()) and result = TRegularMethodCallImplicitSelf(g)