mirror of
https://github.com/github/codeql.git
synced 2026-05-01 19:55:15 +02:00
Merge pull request #226 from github/hvitved/const-flow
Data flow through constants
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
private import codeql_ruby.AST
|
||||
private import internal.AST
|
||||
private import internal.Module
|
||||
private import internal.Variable
|
||||
private import internal.TreeSitter
|
||||
|
||||
@@ -90,6 +91,35 @@ class ConstantReadAccess extends ConstantAccess {
|
||||
this = any(AssignOperation a).getLeftOperand()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value being read, if any. For example, in
|
||||
*
|
||||
* ```rb
|
||||
* module M
|
||||
* CONST = "const"
|
||||
* end
|
||||
*
|
||||
* puts M::CONST
|
||||
* ```
|
||||
*
|
||||
* the value being read at `M::CONST` is `"const"`.
|
||||
*/
|
||||
Expr getValue() {
|
||||
not exists(this.getScopeExpr()) and
|
||||
result = lookupConst(this.getEnclosingModule+().getModule(), this.getName()) and
|
||||
// For now, we restrict the scope of top-level declarations to their file.
|
||||
// This may remove some plausible targets, but also removes a lot of
|
||||
// implausible targets
|
||||
if result.getEnclosingModule() instanceof Toplevel
|
||||
then result.getFile() = this.getFile()
|
||||
else any()
|
||||
or
|
||||
this.hasGlobalScope() and
|
||||
result = lookupConst(TResolved("Object"), this.getName())
|
||||
or
|
||||
result = lookupConst(resolveScopeExpr(this.getScopeExpr()), this.getName())
|
||||
}
|
||||
|
||||
final override string getAPrimaryQlClass() { result = "ConstantReadAccess" }
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,26 @@ class ModuleBase extends BodyStmt, Scope, TModuleBase {
|
||||
result = this.getAModule() and result.getName() = name
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the constant named `name`, if any.
|
||||
*
|
||||
* For example, the value of `CONST` is `"const"` in
|
||||
* ```rb
|
||||
* module M
|
||||
* CONST = "const"
|
||||
* end
|
||||
* ```
|
||||
*/
|
||||
Expr getConstant(string name) {
|
||||
exists(AssignExpr ae, ConstantWriteAccess w |
|
||||
ae = this.getAStmt() and
|
||||
w = ae.getLeftOperand() and
|
||||
w.getName() = name and
|
||||
not exists(w.getScopeExpr()) and
|
||||
result = ae.getRightOperand()
|
||||
)
|
||||
}
|
||||
|
||||
/** Gets the representation of the run-time value of this module or class. */
|
||||
Module getModule() { none() }
|
||||
}
|
||||
|
||||
@@ -130,6 +130,21 @@ private module Cached {
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
cached
|
||||
Method lookupMethod(Module m, string name) { TMethod(result) = lookupMethodOrConst(m, name) }
|
||||
|
||||
cached
|
||||
Expr lookupConst(Module m, string name) {
|
||||
TExpr(result) = lookupMethodOrConst(m, name)
|
||||
or
|
||||
exists(AssignExpr ae, ConstantWriteAccess w |
|
||||
w = ae.getLeftOperand() and
|
||||
w.getName() = name and
|
||||
m = resolveScopeExpr(w.getScopeExpr()) and
|
||||
result = ae.getRightOperand()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import Cached
|
||||
@@ -340,24 +355,47 @@ private Module getAncestors(Module m) {
|
||||
result = getAncestors(m.getAPrependedModule())
|
||||
}
|
||||
|
||||
Method getMethod(TModule owner, string name) {
|
||||
exists(ModuleBase m | m.getModule() = owner and result = m.getMethod(name))
|
||||
}
|
||||
private newtype TMethodOrExpr =
|
||||
TMethod(Method m) or
|
||||
TExpr(Expr e)
|
||||
|
||||
private Method lookupMethod0(Module m, string name) {
|
||||
result = lookupMethod0(m.getAPrependedModule(), name)
|
||||
or
|
||||
not exists(getMethod(getAncestors(m.getAPrependedModule()), name)) and
|
||||
(
|
||||
result = getMethod(m, name)
|
||||
private TMethodOrExpr getMethodOrConst(TModule owner, string name) {
|
||||
exists(ModuleBase m | m.getModule() = owner |
|
||||
result = TMethod(m.getMethod(name))
|
||||
or
|
||||
not exists(getMethod(m, name)) and result = lookupMethod0(m.getAnIncludedModule(), name)
|
||||
result = TExpr(m.getConstant(name))
|
||||
)
|
||||
}
|
||||
|
||||
Method lookupMethod(Module m, string name) {
|
||||
result = lookupMethod0(m, name)
|
||||
or
|
||||
not exists(lookupMethod0(m, name)) and
|
||||
result = lookupMethod(m.getSuperClass(), name)
|
||||
module ExposedForTestingOnly {
|
||||
Method getMethod(TModule owner, string name) { TMethod(result) = getMethodOrConst(owner, name) }
|
||||
|
||||
Expr getConst(TModule owner, string name) { TExpr(result) = getMethodOrConst(owner, name) }
|
||||
}
|
||||
|
||||
private TMethodOrExpr lookupMethodOrConst0(Module m, string name) {
|
||||
result = lookupMethodOrConst0(m.getAPrependedModule(), name)
|
||||
or
|
||||
not exists(getMethodOrConst(getAncestors(m.getAPrependedModule()), name)) and
|
||||
(
|
||||
result = getMethodOrConst(m, name)
|
||||
or
|
||||
not exists(getMethodOrConst(m, name)) and
|
||||
result = lookupMethodOrConst0(m.getAnIncludedModule(), name)
|
||||
)
|
||||
}
|
||||
|
||||
private AstNode getNode(TMethodOrExpr e) { e = TMethod(result) or e = TExpr(result) }
|
||||
|
||||
private TMethodOrExpr lookupMethodOrConst(Module m, string name) {
|
||||
result = lookupMethodOrConst0(m, name)
|
||||
or
|
||||
not exists(lookupMethodOrConst0(m, name)) and
|
||||
result = lookupMethodOrConst(m.getSuperClass(), name) and
|
||||
// For now, we restrict the scope of top-level declarations to their file.
|
||||
// This may remove some plausible targets, but also removes a lot of
|
||||
// implausible targets
|
||||
if getNode(result).getEnclosingModule() instanceof Toplevel
|
||||
then getNode(result).getFile() = m.getADeclaration().getFile()
|
||||
else any()
|
||||
}
|
||||
|
||||
@@ -455,6 +455,8 @@ predicate jumpStep(Node pred, Node succ) {
|
||||
m = s.getEnclosingMethod() and
|
||||
m != s.getEnclosingCallable()
|
||||
)
|
||||
or
|
||||
succ.asExpr().getExpr().(ConstantReadAccess).getValue() = pred.asExpr().getExpr()
|
||||
}
|
||||
|
||||
predicate storeStep(Node node1, Content c, Node node2) { none() }
|
||||
|
||||
@@ -803,53 +803,81 @@ constants/constants.rb:
|
||||
# 1| [Toplevel] constants.rb
|
||||
# 1| getStmt: [ModuleDeclaration] ModuleA
|
||||
# 2| getStmt: [ClassDeclaration] ClassA
|
||||
# 5| getStmt: [ModuleDeclaration] ModuleB
|
||||
# 6| getStmt: [ClassDeclaration] ClassB
|
||||
# 6| getSuperclassExpr: [ConstantReadAccess] Base
|
||||
# 9| getStmt: [ClassDeclaration] ClassC
|
||||
# 9| getSuperclassExpr: [ConstantReadAccess] Z
|
||||
# 9| getScopeExpr: [ConstantReadAccess] Y
|
||||
# 9| getScopeExpr: [ConstantReadAccess] X
|
||||
# 14| getStmt: [AssignExpr] ... = ...
|
||||
# 14| getAnOperand/getLeftOperand: [ConstantAssignment] GREETING
|
||||
# 14| getAnOperand/getRightOperand: [StringLiteral] "Hello"
|
||||
# 14| getComponent: [StringTextComponent] Hello
|
||||
# 16| getStmt: [Method] foo
|
||||
# 17| getStmt: [AssignExpr] ... = ...
|
||||
# 17| getAnOperand/getLeftOperand: [ConstantAssignment] Names
|
||||
# 17| getAnOperand/getRightOperand: [ArrayLiteral] [...]
|
||||
# 17| getElement: [StringLiteral] "Vera"
|
||||
# 17| getComponent: [StringTextComponent] Vera
|
||||
# 17| getElement: [StringLiteral] "Chuck"
|
||||
# 17| getComponent: [StringTextComponent] Chuck
|
||||
# 17| getElement: [StringLiteral] "Dave"
|
||||
# 17| getComponent: [StringTextComponent] Dave
|
||||
# 19| getStmt: [MethodCall] call to each
|
||||
# 19| getReceiver: [ConstantReadAccess] Names
|
||||
# 19| getBlock: [DoBlock] do ... end
|
||||
# 19| getParameter: [SimpleParameter] name
|
||||
# 19| getDefiningAccess: [LocalVariableAccess] name
|
||||
# 20| getStmt: [MethodCall] call to puts
|
||||
# 20| getReceiver: [Self] self
|
||||
# 20| getArgument: [StringLiteral] "#{...} #{...}"
|
||||
# 20| getComponent: [StringInterpolationComponent] #{...}
|
||||
# 20| getStmt: [ConstantReadAccess] GREETING
|
||||
# 20| getComponent: [StringTextComponent]
|
||||
# 20| getComponent: [StringInterpolationComponent] #{...}
|
||||
# 20| getStmt: [LocalVariableAccess] name
|
||||
# 25| getStmt: [MethodCall] call to Array
|
||||
# 25| getReceiver: [Self] self
|
||||
# 25| getArgument: [StringLiteral] "foo"
|
||||
# 25| getComponent: [StringTextComponent] foo
|
||||
# 28| getStmt: [ClassDeclaration] ClassD
|
||||
# 28| getScopeExpr: [ConstantReadAccess] ModuleA
|
||||
# 31| getStmt: [ModuleDeclaration] ModuleC
|
||||
# 3| getStmt: [AssignExpr] ... = ...
|
||||
# 3| getAnOperand/getLeftOperand: [ConstantAssignment] CONST_A
|
||||
# 3| getAnOperand/getRightOperand: [StringLiteral] "const_a"
|
||||
# 3| getComponent: [StringTextComponent] const_a
|
||||
# 6| getStmt: [AssignExpr] ... = ...
|
||||
# 6| getAnOperand/getLeftOperand: [ConstantAssignment] CONST_B
|
||||
# 6| getAnOperand/getRightOperand: [StringLiteral] "const_b"
|
||||
# 6| getComponent: [StringTextComponent] const_b
|
||||
# 8| getStmt: [ModuleDeclaration] ModuleB
|
||||
# 9| getStmt: [ClassDeclaration] ClassB
|
||||
# 9| getSuperclassExpr: [ConstantReadAccess] Base
|
||||
# 12| getStmt: [ClassDeclaration] ClassC
|
||||
# 12| getSuperclassExpr: [ConstantReadAccess] Z
|
||||
# 12| getScopeExpr: [ConstantReadAccess] Y
|
||||
# 12| getScopeExpr: [ConstantReadAccess] X
|
||||
# 17| getStmt: [AssignExpr] ... = ...
|
||||
# 17| getAnOperand/getLeftOperand: [ConstantAssignment] GREETING
|
||||
# 17| getAnOperand/getRightOperand: [AddExpr] ... + ...
|
||||
# 17| getAnOperand/getLeftOperand: [AddExpr] ... + ...
|
||||
# 17| getAnOperand/getLeftOperand: [StringLiteral] "Hello"
|
||||
# 17| getComponent: [StringTextComponent] Hello
|
||||
# 17| getAnOperand/getRightOperand: [ConstantReadAccess] CONST_A
|
||||
# 17| getScopeExpr: [ConstantReadAccess] ClassA
|
||||
# 17| getScopeExpr: [ConstantReadAccess] ModuleA
|
||||
# 17| getAnOperand/getRightOperand: [ConstantReadAccess] CONST_B
|
||||
# 17| getScopeExpr: [ConstantReadAccess] ModuleA
|
||||
# 19| getStmt: [Method] foo
|
||||
# 20| getStmt: [AssignExpr] ... = ...
|
||||
# 20| getAnOperand/getLeftOperand: [ConstantAssignment] Names
|
||||
# 20| getAnOperand/getRightOperand: [ArrayLiteral] [...]
|
||||
# 20| getElement: [StringLiteral] "Vera"
|
||||
# 20| getComponent: [StringTextComponent] Vera
|
||||
# 20| getElement: [StringLiteral] "Chuck"
|
||||
# 20| getComponent: [StringTextComponent] Chuck
|
||||
# 20| getElement: [StringLiteral] "Dave"
|
||||
# 20| getComponent: [StringTextComponent] Dave
|
||||
# 22| getStmt: [MethodCall] call to each
|
||||
# 22| getReceiver: [ConstantReadAccess] Names
|
||||
# 22| getBlock: [DoBlock] do ... end
|
||||
# 22| getParameter: [SimpleParameter] name
|
||||
# 22| getDefiningAccess: [LocalVariableAccess] name
|
||||
# 23| getStmt: [MethodCall] call to puts
|
||||
# 23| getReceiver: [Self] self
|
||||
# 23| getArgument: [StringLiteral] "#{...} #{...}"
|
||||
# 23| getComponent: [StringInterpolationComponent] #{...}
|
||||
# 23| getStmt: [ConstantReadAccess] GREETING
|
||||
# 23| getComponent: [StringTextComponent]
|
||||
# 23| getComponent: [StringInterpolationComponent] #{...}
|
||||
# 23| getStmt: [LocalVariableAccess] name
|
||||
# 28| getStmt: [MethodCall] call to Array
|
||||
# 28| getReceiver: [Self] self
|
||||
# 28| getArgument: [StringLiteral] "foo"
|
||||
# 28| getComponent: [StringTextComponent] foo
|
||||
# 31| getStmt: [ClassDeclaration] ClassD
|
||||
# 31| getScopeExpr: [ConstantReadAccess] ModuleA
|
||||
# 34| getStmt: [AssignExpr] ... = ...
|
||||
# 34| getAnOperand/getLeftOperand: [ConstantAssignment] MAX_SIZE
|
||||
# 34| getScopeExpr: [ConstantReadAccess] ModuleB
|
||||
# 34| getScopeExpr: [ConstantReadAccess] ModuleA
|
||||
# 34| getAnOperand/getRightOperand: [IntegerLiteral] 1024
|
||||
# 31| getSuperclassExpr: [ConstantReadAccess] ClassA
|
||||
# 31| getScopeExpr: [ConstantReadAccess] ModuleA
|
||||
# 34| getStmt: [ModuleDeclaration] ModuleC
|
||||
# 34| getScopeExpr: [ConstantReadAccess] ModuleA
|
||||
# 37| getStmt: [AssignExpr] ... = ...
|
||||
# 37| getAnOperand/getLeftOperand: [ConstantAssignment] MAX_SIZE
|
||||
# 37| getScopeExpr: [ConstantReadAccess] ModuleB
|
||||
# 37| getScopeExpr: [ConstantReadAccess] ModuleA
|
||||
# 37| getAnOperand/getRightOperand: [IntegerLiteral] 1024
|
||||
# 39| getStmt: [MethodCall] call to puts
|
||||
# 39| getReceiver: [Self] self
|
||||
# 39| getArgument: [ConstantReadAccess] MAX_SIZE
|
||||
# 39| getScopeExpr: [ConstantReadAccess] ModuleB
|
||||
# 39| getScopeExpr: [ConstantReadAccess] ModuleA
|
||||
# 41| getStmt: [MethodCall] call to puts
|
||||
# 41| getReceiver: [Self] self
|
||||
# 41| getArgument: [ConstantReadAccess] GREETING
|
||||
# 42| getStmt: [MethodCall] call to puts
|
||||
# 42| getReceiver: [Self] self
|
||||
# 42| getArgument: [ConstantReadAccess] GREETING
|
||||
literals/literals.rb:
|
||||
# 1| [Toplevel] literals.rb
|
||||
# 2| getStmt: [NilLiteral] nil
|
||||
|
||||
@@ -1,20 +1,56 @@
|
||||
| constants.rb:1:1:12:3 | ModuleA | write | ModuleA | ModuleDeclaration |
|
||||
| constants.rb:2:5:3:7 | ClassA | write | ClassA | ClassDeclaration |
|
||||
| constants.rb:5:5:11:7 | ModuleB | write | ModuleB | ModuleDeclaration |
|
||||
| constants.rb:6:9:7:11 | ClassB | write | ClassB | ClassDeclaration |
|
||||
| constants.rb:6:24:6:27 | Base | read | Base | ConstantReadAccess |
|
||||
| constants.rb:9:9:10:11 | ClassC | write | ClassC | ClassDeclaration |
|
||||
| constants.rb:9:24:9:24 | X | read | X | ConstantReadAccess |
|
||||
| constants.rb:9:24:9:27 | Y | read | Y | ConstantReadAccess |
|
||||
| constants.rb:9:24:9:30 | Z | read | Z | ConstantReadAccess |
|
||||
| constants.rb:14:1:14:8 | GREETING | write | GREETING | ConstantAssignment |
|
||||
| constants.rb:17:5:17:9 | Names | write | Names | ConstantAssignment |
|
||||
| constants.rb:19:5:19:9 | Names | read | Names | ConstantReadAccess |
|
||||
| constants.rb:20:18:20:25 | GREETING | read | GREETING | ConstantReadAccess |
|
||||
| constants.rb:28:1:29:3 | ClassD | write | ClassD | ClassDeclaration |
|
||||
| constants.rb:28:7:28:13 | ModuleA | read | ModuleA | ConstantReadAccess |
|
||||
| constants.rb:31:1:32:3 | ModuleC | write | ModuleC | ModuleDeclaration |
|
||||
| constants.rb:31:8:31:14 | ModuleA | read | ModuleA | ConstantReadAccess |
|
||||
| constants.rb:34:1:34:7 | ModuleA | read | ModuleA | ConstantReadAccess |
|
||||
| constants.rb:34:1:34:16 | ModuleB | read | ModuleB | ConstantReadAccess |
|
||||
| constants.rb:34:1:34:26 | MAX_SIZE | write | MAX_SIZE | ConstantAssignment |
|
||||
constantAccess
|
||||
| constants.rb:1:1:15:3 | ModuleA | write | ModuleA | ModuleDeclaration |
|
||||
| constants.rb:2:5:4:7 | ClassA | write | ClassA | ClassDeclaration |
|
||||
| constants.rb:3:9:3:15 | CONST_A | write | CONST_A | ConstantAssignment |
|
||||
| constants.rb:6:5:6:11 | CONST_B | write | CONST_B | ConstantAssignment |
|
||||
| constants.rb:8:5:14:7 | ModuleB | write | ModuleB | ModuleDeclaration |
|
||||
| constants.rb:9:9:10:11 | ClassB | write | ClassB | ClassDeclaration |
|
||||
| constants.rb:9:24:9:27 | Base | read | Base | ConstantReadAccess |
|
||||
| constants.rb:12:9:13:11 | ClassC | write | ClassC | ClassDeclaration |
|
||||
| constants.rb:12:24:12:24 | X | read | X | ConstantReadAccess |
|
||||
| constants.rb:12:24:12:27 | Y | read | Y | ConstantReadAccess |
|
||||
| constants.rb:12:24:12:30 | Z | read | Z | ConstantReadAccess |
|
||||
| constants.rb:17:1:17:8 | GREETING | write | GREETING | ConstantAssignment |
|
||||
| constants.rb:17:22:17:28 | ModuleA | read | ModuleA | ConstantReadAccess |
|
||||
| constants.rb:17:22:17:36 | ClassA | read | ClassA | ConstantReadAccess |
|
||||
| constants.rb:17:22:17:45 | CONST_A | read | CONST_A | ConstantReadAccess |
|
||||
| constants.rb:17:49:17:55 | ModuleA | read | ModuleA | ConstantReadAccess |
|
||||
| constants.rb:17:49:17:64 | CONST_B | read | CONST_B | ConstantReadAccess |
|
||||
| constants.rb:20:5:20:9 | Names | write | Names | ConstantAssignment |
|
||||
| constants.rb:22:5:22:9 | Names | read | Names | ConstantReadAccess |
|
||||
| constants.rb:23:18:23:25 | GREETING | read | GREETING | ConstantReadAccess |
|
||||
| constants.rb:31:1:32:3 | ClassD | write | ClassD | ClassDeclaration |
|
||||
| constants.rb:31:7:31:13 | ModuleA | read | ModuleA | ConstantReadAccess |
|
||||
| constants.rb:31:25:31:31 | ModuleA | read | ModuleA | ConstantReadAccess |
|
||||
| constants.rb:31:25:31:39 | ClassA | read | ClassA | ConstantReadAccess |
|
||||
| constants.rb:34:1:35:3 | ModuleC | write | ModuleC | ModuleDeclaration |
|
||||
| constants.rb:34:8:34:14 | ModuleA | read | ModuleA | ConstantReadAccess |
|
||||
| constants.rb:37:1:37:7 | ModuleA | read | ModuleA | ConstantReadAccess |
|
||||
| constants.rb:37:1:37:16 | ModuleB | read | ModuleB | ConstantReadAccess |
|
||||
| constants.rb:37:1:37:26 | MAX_SIZE | write | MAX_SIZE | ConstantAssignment |
|
||||
| constants.rb:39:6:39:12 | ModuleA | read | ModuleA | ConstantReadAccess |
|
||||
| constants.rb:39:6:39:21 | ModuleB | read | ModuleB | ConstantReadAccess |
|
||||
| constants.rb:39:6:39:31 | MAX_SIZE | read | MAX_SIZE | ConstantReadAccess |
|
||||
| constants.rb:41:6:41:13 | GREETING | read | GREETING | ConstantReadAccess |
|
||||
| constants.rb:42:6:42:15 | GREETING | read | GREETING | ConstantReadAccess |
|
||||
getConst
|
||||
| constants.rb:1:1:15:3 | ModuleA | CONST_B | constants.rb:6:15:6:23 | "const_b" |
|
||||
| constants.rb:2:5:4:7 | ModuleA::ClassA | CONST_A | constants.rb:3:19:3:27 | "const_a" |
|
||||
| file://:0:0:0:0 | Object | GREETING | constants.rb:17:12:17:64 | ... + ... |
|
||||
lookupConst
|
||||
| constants.rb:1:1:15:3 | ModuleA | CONST_B | constants.rb:6:15:6:23 | "const_b" |
|
||||
| constants.rb:2:5:4:7 | ModuleA::ClassA | CONST_A | constants.rb:3:19:3:27 | "const_a" |
|
||||
| constants.rb:2:5:4:7 | ModuleA::ClassA | GREETING | constants.rb:17:12:17:64 | ... + ... |
|
||||
| constants.rb:8:5:14:7 | ModuleA::ModuleB | MAX_SIZE | constants.rb:37:30:37:33 | 1024 |
|
||||
| constants.rb:9:9:10:11 | ModuleA::ModuleB::ClassB | GREETING | constants.rb:17:12:17:64 | ... + ... |
|
||||
| constants.rb:12:9:13:11 | ModuleA::ModuleB::ClassC | GREETING | constants.rb:17:12:17:64 | ... + ... |
|
||||
| constants.rb:31:1:32:3 | ModuleA::ClassD | CONST_A | constants.rb:3:19:3:27 | "const_a" |
|
||||
| constants.rb:31:1:32:3 | ModuleA::ClassD | GREETING | constants.rb:17:12:17:64 | ... + ... |
|
||||
| file://:0:0:0:0 | Object | GREETING | constants.rb:17:12:17:64 | ... + ... |
|
||||
constantValue
|
||||
| constants.rb:17:22:17:45 | CONST_A | constants.rb:3:19:3:27 | "const_a" |
|
||||
| constants.rb:17:49:17:64 | CONST_B | constants.rb:6:15:6:23 | "const_b" |
|
||||
| constants.rb:23:18:23:25 | GREETING | constants.rb:17:12:17:64 | ... + ... |
|
||||
| constants.rb:39:6:39:31 | MAX_SIZE | constants.rb:37:30:37:33 | 1024 |
|
||||
| constants.rb:41:6:41:13 | GREETING | constants.rb:17:12:17:64 | ... + ... |
|
||||
| constants.rb:42:6:42:15 | GREETING | constants.rb:17:12:17:64 | ... + ... |
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
import ruby
|
||||
import codeql_ruby.ast.internal.Module as M
|
||||
|
||||
from ConstantAccess a, string kind
|
||||
where
|
||||
a instanceof ConstantReadAccess and kind = "read"
|
||||
or
|
||||
a instanceof ConstantWriteAccess and kind = "write"
|
||||
select a, kind, a.getName(), a.getAPrimaryQlClass()
|
||||
query predicate constantAccess(ConstantAccess a, string kind, string name, string cls) {
|
||||
(
|
||||
a instanceof ConstantReadAccess and kind = "read"
|
||||
or
|
||||
a instanceof ConstantWriteAccess and kind = "write"
|
||||
) and
|
||||
name = a.getName() and
|
||||
cls = a.getAPrimaryQlClass()
|
||||
}
|
||||
|
||||
query Expr getConst(Module m, string name) { result = M::ExposedForTestingOnly::getConst(m, name) }
|
||||
|
||||
query Expr lookupConst(Module m, string name) { result = M::lookupConst(m, name) }
|
||||
|
||||
query predicate constantValue(ConstantReadAccess a, Expr e) { e = a.getValue() }
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
module ModuleA
|
||||
class ClassA
|
||||
CONST_A = "const_a"
|
||||
end
|
||||
|
||||
CONST_B = "const_b"
|
||||
|
||||
module ModuleB
|
||||
class ClassB < Base
|
||||
end
|
||||
@@ -11,7 +14,7 @@ module ModuleA
|
||||
end
|
||||
end
|
||||
|
||||
GREETING = 'Hello'
|
||||
GREETING = 'Hello' + ModuleA::ClassA::CONST_A + ModuleA::CONST_B
|
||||
|
||||
def foo
|
||||
Names = ['Vera', 'Chuck', 'Dave']
|
||||
@@ -25,10 +28,15 @@ def foo
|
||||
Array('foo')
|
||||
end
|
||||
|
||||
class ModuleA::ClassD
|
||||
class ModuleA::ClassD < ModuleA::ClassA
|
||||
end
|
||||
|
||||
module ModuleA::ModuleC
|
||||
end
|
||||
|
||||
ModuleA::ModuleB::MAX_SIZE = 1024
|
||||
ModuleA::ModuleB::MAX_SIZE = 1024
|
||||
|
||||
puts ModuleA::ModuleB::MAX_SIZE
|
||||
|
||||
puts GREETING
|
||||
puts ::GREETING
|
||||
|
||||
@@ -55,20 +55,11 @@ lookupMethod
|
||||
| calls.rb:51:1:55:3 | D | private3 | private.rb:14:3:15:5 | private3 |
|
||||
| calls.rb:51:1:55:3 | D | private4 | private.rb:17:3:18:5 | private4 |
|
||||
| calls.rb:51:1:55:3 | D | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| calls.rb:51:1:55:3 | D | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| calls.rb:51:1:55:3 | D | public | private.rb:5:3:6:5 | public |
|
||||
| calls.rb:51:1:55:3 | D | puts | calls.rb:87:5:87:17 | puts |
|
||||
| calls.rb:77:1:80:3 | Integer | abs | calls.rb:79:5:79:16 | abs |
|
||||
| calls.rb:77:1:80:3 | Integer | bit_length | calls.rb:78:5:78:23 | bit_length |
|
||||
| calls.rb:77:1:80:3 | Integer | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| calls.rb:77:1:80:3 | Integer | foo | calls.rb:1:1:3:3 | foo |
|
||||
| calls.rb:77:1:80:3 | Integer | foo | calls.rb:71:1:75:3 | foo |
|
||||
| calls.rb:77:1:80:3 | Integer | funny | calls.rb:119:1:121:3 | funny |
|
||||
| calls.rb:77:1:80:3 | Integer | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| calls.rb:77:1:80:3 | Integer | new | calls.rb:99:5:99:16 | new |
|
||||
| calls.rb:77:1:80:3 | Integer | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| calls.rb:77:1:80:3 | Integer | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| calls.rb:77:1:80:3 | Integer | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| calls.rb:77:1:80:3 | Integer | puts | calls.rb:87:5:87:17 | puts |
|
||||
| calls.rb:82:1:84:3 | String | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| calls.rb:82:1:84:3 | String | capitalize | calls.rb:83:5:83:23 | capitalize |
|
||||
@@ -79,7 +70,6 @@ lookupMethod
|
||||
| calls.rb:82:1:84:3 | String | new | calls.rb:99:5:99:16 | new |
|
||||
| calls.rb:82:1:84:3 | String | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| calls.rb:82:1:84:3 | String | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| calls.rb:82:1:84:3 | String | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| calls.rb:82:1:84:3 | String | puts | calls.rb:87:5:87:17 | puts |
|
||||
| calls.rb:86:1:88:3 | Kernel | puts | calls.rb:87:5:87:17 | puts |
|
||||
| calls.rb:90:1:95:3 | Module | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
@@ -94,7 +84,6 @@ lookupMethod
|
||||
| calls.rb:90:1:95:3 | Module | prepend | calls.rb:93:5:93:20 | prepend |
|
||||
| calls.rb:90:1:95:3 | Module | private | calls.rb:94:5:94:20 | private |
|
||||
| calls.rb:90:1:95:3 | Module | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| calls.rb:90:1:95:3 | Module | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| calls.rb:90:1:95:3 | Module | puts | calls.rb:87:5:87:17 | puts |
|
||||
| calls.rb:97:1:100:3 | Object | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| calls.rb:97:1:100:3 | Object | foo | calls.rb:1:1:3:3 | foo |
|
||||
@@ -115,7 +104,6 @@ lookupMethod
|
||||
| calls.rb:102:1:104:3 | Hash | new | calls.rb:99:5:99:16 | new |
|
||||
| calls.rb:102:1:104:3 | Hash | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| calls.rb:102:1:104:3 | Hash | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| calls.rb:102:1:104:3 | Hash | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| calls.rb:102:1:104:3 | Hash | puts | calls.rb:87:5:87:17 | puts |
|
||||
| calls.rb:106:1:117:3 | Array | [] | calls.rb:107:3:107:13 | [] |
|
||||
| calls.rb:106:1:117:3 | Array | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
@@ -128,7 +116,6 @@ lookupMethod
|
||||
| calls.rb:106:1:117:3 | Array | new | calls.rb:99:5:99:16 | new |
|
||||
| calls.rb:106:1:117:3 | Array | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| calls.rb:106:1:117:3 | Array | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| calls.rb:106:1:117:3 | Array | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| calls.rb:106:1:117:3 | Array | puts | calls.rb:87:5:87:17 | puts |
|
||||
| calls.rb:144:1:148:3 | S | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| calls.rb:144:1:148:3 | S | foo | calls.rb:1:1:3:3 | foo |
|
||||
@@ -138,7 +125,6 @@ lookupMethod
|
||||
| calls.rb:144:1:148:3 | S | new | calls.rb:99:5:99:16 | new |
|
||||
| calls.rb:144:1:148:3 | S | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| calls.rb:144:1:148:3 | S | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| calls.rb:144:1:148:3 | S | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| calls.rb:144:1:148:3 | S | puts | calls.rb:87:5:87:17 | puts |
|
||||
| calls.rb:144:1:148:3 | S | s_method | calls.rb:145:5:147:7 | s_method |
|
||||
| calls.rb:150:1:153:3 | A | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
@@ -149,7 +135,6 @@ lookupMethod
|
||||
| calls.rb:150:1:153:3 | A | new | calls.rb:99:5:99:16 | new |
|
||||
| calls.rb:150:1:153:3 | A | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| calls.rb:150:1:153:3 | A | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| calls.rb:150:1:153:3 | A | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| calls.rb:150:1:153:3 | A | puts | calls.rb:87:5:87:17 | puts |
|
||||
| calls.rb:150:1:153:3 | A | s_method | calls.rb:145:5:147:7 | s_method |
|
||||
| calls.rb:150:1:153:3 | A | to_s | calls.rb:151:5:152:7 | to_s |
|
||||
@@ -161,217 +146,64 @@ lookupMethod
|
||||
| calls.rb:155:1:158:3 | B | new | calls.rb:99:5:99:16 | new |
|
||||
| calls.rb:155:1:158:3 | B | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| calls.rb:155:1:158:3 | B | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| calls.rb:155:1:158:3 | B | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| calls.rb:155:1:158:3 | B | puts | calls.rb:87:5:87:17 | puts |
|
||||
| calls.rb:155:1:158:3 | B | s_method | calls.rb:145:5:147:7 | s_method |
|
||||
| calls.rb:155:1:158:3 | B | to_s | calls.rb:156:5:157:7 | to_s |
|
||||
| file://:0:0:0:0 | Class | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| file://:0:0:0:0 | Class | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | Class | foo | calls.rb:71:1:75:3 | foo |
|
||||
| file://:0:0:0:0 | Class | funny | calls.rb:119:1:121:3 | funny |
|
||||
| file://:0:0:0:0 | Class | include | calls.rb:92:5:92:20 | include |
|
||||
| file://:0:0:0:0 | Class | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| file://:0:0:0:0 | Class | module_eval | calls.rb:91:5:91:24 | module_eval |
|
||||
| file://:0:0:0:0 | Class | new | calls.rb:99:5:99:16 | new |
|
||||
| file://:0:0:0:0 | Class | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| file://:0:0:0:0 | Class | prepend | calls.rb:93:5:93:20 | prepend |
|
||||
| file://:0:0:0:0 | Class | private | calls.rb:94:5:94:20 | private |
|
||||
| file://:0:0:0:0 | Class | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| file://:0:0:0:0 | Class | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| file://:0:0:0:0 | Class | puts | calls.rb:87:5:87:17 | puts |
|
||||
| file://:0:0:0:0 | Complex | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| file://:0:0:0:0 | Complex | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | Complex | foo | calls.rb:71:1:75:3 | foo |
|
||||
| file://:0:0:0:0 | Complex | funny | calls.rb:119:1:121:3 | funny |
|
||||
| file://:0:0:0:0 | Complex | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| file://:0:0:0:0 | Complex | new | calls.rb:99:5:99:16 | new |
|
||||
| file://:0:0:0:0 | Complex | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| file://:0:0:0:0 | Complex | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| file://:0:0:0:0 | Complex | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| file://:0:0:0:0 | Complex | puts | calls.rb:87:5:87:17 | puts |
|
||||
| file://:0:0:0:0 | FalseClass | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| file://:0:0:0:0 | FalseClass | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | FalseClass | foo | calls.rb:71:1:75:3 | foo |
|
||||
| file://:0:0:0:0 | FalseClass | funny | calls.rb:119:1:121:3 | funny |
|
||||
| file://:0:0:0:0 | FalseClass | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| file://:0:0:0:0 | FalseClass | new | calls.rb:99:5:99:16 | new |
|
||||
| file://:0:0:0:0 | FalseClass | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| file://:0:0:0:0 | FalseClass | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| file://:0:0:0:0 | FalseClass | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| file://:0:0:0:0 | FalseClass | puts | calls.rb:87:5:87:17 | puts |
|
||||
| file://:0:0:0:0 | Float | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| file://:0:0:0:0 | Float | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | Float | foo | calls.rb:71:1:75:3 | foo |
|
||||
| file://:0:0:0:0 | Float | funny | calls.rb:119:1:121:3 | funny |
|
||||
| file://:0:0:0:0 | Float | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| file://:0:0:0:0 | Float | new | calls.rb:99:5:99:16 | new |
|
||||
| file://:0:0:0:0 | Float | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| file://:0:0:0:0 | Float | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| file://:0:0:0:0 | Float | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| file://:0:0:0:0 | Float | puts | calls.rb:87:5:87:17 | puts |
|
||||
| file://:0:0:0:0 | NilClass | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| file://:0:0:0:0 | NilClass | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | NilClass | foo | calls.rb:71:1:75:3 | foo |
|
||||
| file://:0:0:0:0 | NilClass | funny | calls.rb:119:1:121:3 | funny |
|
||||
| file://:0:0:0:0 | NilClass | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| file://:0:0:0:0 | NilClass | new | calls.rb:99:5:99:16 | new |
|
||||
| file://:0:0:0:0 | NilClass | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| file://:0:0:0:0 | NilClass | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| file://:0:0:0:0 | NilClass | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| file://:0:0:0:0 | NilClass | puts | calls.rb:87:5:87:17 | puts |
|
||||
| file://:0:0:0:0 | Numeric | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| file://:0:0:0:0 | Numeric | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | Numeric | foo | calls.rb:71:1:75:3 | foo |
|
||||
| file://:0:0:0:0 | Numeric | funny | calls.rb:119:1:121:3 | funny |
|
||||
| file://:0:0:0:0 | Numeric | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| file://:0:0:0:0 | Numeric | new | calls.rb:99:5:99:16 | new |
|
||||
| file://:0:0:0:0 | Numeric | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| file://:0:0:0:0 | Numeric | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| file://:0:0:0:0 | Numeric | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| file://:0:0:0:0 | Numeric | puts | calls.rb:87:5:87:17 | puts |
|
||||
| file://:0:0:0:0 | Rational | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| file://:0:0:0:0 | Rational | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | Rational | foo | calls.rb:71:1:75:3 | foo |
|
||||
| file://:0:0:0:0 | Rational | funny | calls.rb:119:1:121:3 | funny |
|
||||
| file://:0:0:0:0 | Rational | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| file://:0:0:0:0 | Rational | new | calls.rb:99:5:99:16 | new |
|
||||
| file://:0:0:0:0 | Rational | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| file://:0:0:0:0 | Rational | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| file://:0:0:0:0 | Rational | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| file://:0:0:0:0 | Rational | puts | calls.rb:87:5:87:17 | puts |
|
||||
| file://:0:0:0:0 | TrueClass | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| file://:0:0:0:0 | TrueClass | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | TrueClass | foo | calls.rb:71:1:75:3 | foo |
|
||||
| file://:0:0:0:0 | TrueClass | funny | calls.rb:119:1:121:3 | funny |
|
||||
| file://:0:0:0:0 | TrueClass | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| file://:0:0:0:0 | TrueClass | new | calls.rb:99:5:99:16 | new |
|
||||
| file://:0:0:0:0 | TrueClass | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| file://:0:0:0:0 | TrueClass | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| file://:0:0:0:0 | TrueClass | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| file://:0:0:0:0 | TrueClass | puts | calls.rb:87:5:87:17 | puts |
|
||||
| hello.rb:1:1:8:3 | EnglishWords | hello | hello.rb:2:5:4:7 | hello |
|
||||
| hello.rb:1:1:8:3 | EnglishWords | world | hello.rb:5:5:7:7 | world |
|
||||
| hello.rb:11:1:16:3 | Greeting | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| hello.rb:11:1:16:3 | Greeting | foo | calls.rb:1:1:3:3 | foo |
|
||||
| hello.rb:11:1:16:3 | Greeting | foo | calls.rb:71:1:75:3 | foo |
|
||||
| hello.rb:11:1:16:3 | Greeting | funny | calls.rb:119:1:121:3 | funny |
|
||||
| hello.rb:11:1:16:3 | Greeting | hello | hello.rb:2:5:4:7 | hello |
|
||||
| hello.rb:11:1:16:3 | Greeting | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| hello.rb:11:1:16:3 | Greeting | message | hello.rb:13:5:15:7 | message |
|
||||
| hello.rb:11:1:16:3 | Greeting | new | calls.rb:99:5:99:16 | new |
|
||||
| hello.rb:11:1:16:3 | Greeting | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| hello.rb:11:1:16:3 | Greeting | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| hello.rb:11:1:16:3 | Greeting | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| hello.rb:11:1:16:3 | Greeting | puts | calls.rb:87:5:87:17 | puts |
|
||||
| hello.rb:11:1:16:3 | Greeting | world | hello.rb:5:5:7:7 | world |
|
||||
| hello.rb:18:1:22:3 | HelloWorld | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| hello.rb:18:1:22:3 | HelloWorld | foo | calls.rb:1:1:3:3 | foo |
|
||||
| hello.rb:18:1:22:3 | HelloWorld | foo | calls.rb:71:1:75:3 | foo |
|
||||
| hello.rb:18:1:22:3 | HelloWorld | funny | calls.rb:119:1:121:3 | funny |
|
||||
| hello.rb:18:1:22:3 | HelloWorld | hello | hello.rb:2:5:4:7 | hello |
|
||||
| hello.rb:18:1:22:3 | HelloWorld | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| hello.rb:18:1:22:3 | HelloWorld | message | hello.rb:19:5:21:7 | message |
|
||||
| hello.rb:18:1:22:3 | HelloWorld | new | calls.rb:99:5:99:16 | new |
|
||||
| hello.rb:18:1:22:3 | HelloWorld | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| hello.rb:18:1:22:3 | HelloWorld | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| hello.rb:18:1:22:3 | HelloWorld | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| hello.rb:18:1:22:3 | HelloWorld | puts | calls.rb:87:5:87:17 | puts |
|
||||
| hello.rb:18:1:22:3 | HelloWorld | world | hello.rb:5:5:7:7 | world |
|
||||
| modules.rb:4:1:24:3 | Foo | method_in_another_definition_of_foo | modules.rb:27:3:28:5 | method_in_another_definition_of_foo |
|
||||
| modules.rb:4:1:24:3 | Foo | method_in_foo | modules.rb:16:3:17:5 | method_in_foo |
|
||||
| modules.rb:5:3:14:5 | Foo::Bar | method_in_another_definition_of_foo_bar | modules.rb:52:3:53:5 | method_in_another_definition_of_foo_bar |
|
||||
| modules.rb:5:3:14:5 | Foo::Bar | method_in_foo_bar | modules.rb:9:5:10:7 | method_in_foo_bar |
|
||||
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | foo | calls.rb:1:1:3:3 | foo |
|
||||
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | foo | calls.rb:71:1:75:3 | foo |
|
||||
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | funny | calls.rb:119:1:121:3 | funny |
|
||||
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | new | calls.rb:99:5:99:16 | new |
|
||||
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | puts | calls.rb:87:5:87:17 | puts |
|
||||
| modules.rb:19:3:20:5 | Foo::ClassInFoo | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| modules.rb:19:3:20:5 | Foo::ClassInFoo | foo | calls.rb:1:1:3:3 | foo |
|
||||
| modules.rb:19:3:20:5 | Foo::ClassInFoo | foo | calls.rb:71:1:75:3 | foo |
|
||||
| modules.rb:19:3:20:5 | Foo::ClassInFoo | funny | calls.rb:119:1:121:3 | funny |
|
||||
| modules.rb:19:3:20:5 | Foo::ClassInFoo | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| modules.rb:19:3:20:5 | Foo::ClassInFoo | new | calls.rb:99:5:99:16 | new |
|
||||
| modules.rb:19:3:20:5 | Foo::ClassInFoo | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| modules.rb:19:3:20:5 | Foo::ClassInFoo | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| modules.rb:19:3:20:5 | Foo::ClassInFoo | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| modules.rb:19:3:20:5 | Foo::ClassInFoo | puts | calls.rb:87:5:87:17 | puts |
|
||||
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | foo | calls.rb:1:1:3:3 | foo |
|
||||
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | foo | calls.rb:71:1:75:3 | foo |
|
||||
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | funny | calls.rb:119:1:121:3 | funny |
|
||||
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | new | calls.rb:99:5:99:16 | new |
|
||||
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | puts | calls.rb:87:5:87:17 | puts |
|
||||
| modules.rb:37:1:46:3 | Bar | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| modules.rb:37:1:46:3 | Bar | foo | calls.rb:1:1:3:3 | foo |
|
||||
| modules.rb:37:1:46:3 | Bar | foo | calls.rb:71:1:75:3 | foo |
|
||||
| modules.rb:37:1:46:3 | Bar | funny | calls.rb:119:1:121:3 | funny |
|
||||
| modules.rb:37:1:46:3 | Bar | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| modules.rb:37:1:46:3 | Bar | method_a | modules.rb:38:3:39:5 | method_a |
|
||||
| modules.rb:37:1:46:3 | Bar | method_b | modules.rb:41:3:42:5 | method_b |
|
||||
| modules.rb:37:1:46:3 | Bar | new | calls.rb:99:5:99:16 | new |
|
||||
| modules.rb:37:1:46:3 | Bar | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| modules.rb:37:1:46:3 | Bar | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| modules.rb:37:1:46:3 | Bar | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| modules.rb:37:1:46:3 | Bar | puts | calls.rb:87:5:87:17 | puts |
|
||||
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | foo | calls.rb:1:1:3:3 | foo |
|
||||
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | foo | calls.rb:71:1:75:3 | foo |
|
||||
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | funny | calls.rb:119:1:121:3 | funny |
|
||||
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | new | calls.rb:99:5:99:16 | new |
|
||||
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | puts | calls.rb:87:5:87:17 | puts |
|
||||
| modules.rb:66:5:67:7 | Test::Foo1::Bar | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| modules.rb:66:5:67:7 | Test::Foo1::Bar | foo | calls.rb:1:1:3:3 | foo |
|
||||
| modules.rb:66:5:67:7 | Test::Foo1::Bar | foo | calls.rb:71:1:75:3 | foo |
|
||||
| modules.rb:66:5:67:7 | Test::Foo1::Bar | funny | calls.rb:119:1:121:3 | funny |
|
||||
| modules.rb:66:5:67:7 | Test::Foo1::Bar | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| modules.rb:66:5:67:7 | Test::Foo1::Bar | new | calls.rb:99:5:99:16 | new |
|
||||
| modules.rb:66:5:67:7 | Test::Foo1::Bar | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| modules.rb:66:5:67:7 | Test::Foo1::Bar | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| modules.rb:66:5:67:7 | Test::Foo1::Bar | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| modules.rb:66:5:67:7 | Test::Foo1::Bar | puts | calls.rb:87:5:87:17 | puts |
|
||||
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | foo | calls.rb:1:1:3:3 | foo |
|
||||
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | foo | calls.rb:71:1:75:3 | foo |
|
||||
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | funny | calls.rb:119:1:121:3 | funny |
|
||||
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | new | calls.rb:99:5:99:16 | new |
|
||||
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | puts | calls.rb:87:5:87:17 | puts |
|
||||
| modules.rb:112:1:113:3 | YY | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| modules.rb:112:1:113:3 | YY | foo | calls.rb:1:1:3:3 | foo |
|
||||
| modules.rb:112:1:113:3 | YY | foo | calls.rb:71:1:75:3 | foo |
|
||||
| modules.rb:112:1:113:3 | YY | funny | calls.rb:119:1:121:3 | funny |
|
||||
| modules.rb:112:1:113:3 | YY | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| modules.rb:112:1:113:3 | YY | new | calls.rb:99:5:99:16 | new |
|
||||
| modules.rb:112:1:113:3 | YY | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| modules.rb:112:1:113:3 | YY | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| modules.rb:112:1:113:3 | YY | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| modules.rb:112:1:113:3 | YY | puts | calls.rb:87:5:87:17 | puts |
|
||||
| modules.rb:116:7:117:9 | XX::YY | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
| modules.rb:116:7:117:9 | XX::YY | foo | calls.rb:1:1:3:3 | foo |
|
||||
| modules.rb:116:7:117:9 | XX::YY | foo | calls.rb:71:1:75:3 | foo |
|
||||
| modules.rb:116:7:117:9 | XX::YY | funny | calls.rb:119:1:121:3 | funny |
|
||||
| modules.rb:116:7:117:9 | XX::YY | indirect | calls.rb:137:1:139:3 | indirect |
|
||||
| modules.rb:116:7:117:9 | XX::YY | new | calls.rb:99:5:99:16 | new |
|
||||
| modules.rb:116:7:117:9 | XX::YY | optional_arg | calls.rb:62:1:65:3 | optional_arg |
|
||||
| modules.rb:116:7:117:9 | XX::YY | private_on_main | calls.rb:164:1:165:3 | private_on_main |
|
||||
| modules.rb:116:7:117:9 | XX::YY | private_on_main | private.rb:21:1:22:3 | private_on_main |
|
||||
| modules.rb:116:7:117:9 | XX::YY | puts | calls.rb:87:5:87:17 | puts |
|
||||
| private.rb:1:1:19:3 | C | baz | calls.rb:37:5:43:7 | baz |
|
||||
| private.rb:1:1:19:3 | C | call_block | calls.rb:67:1:69:3 | call_block |
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import ruby
|
||||
import codeql_ruby.ast.internal.Module as M
|
||||
|
||||
query MethodBase getMethod(Module m, string name) { result = M::getMethod(m, name) }
|
||||
query MethodBase getMethod(Module m, string name) {
|
||||
result = M::ExposedForTestingOnly::getMethod(m, name)
|
||||
}
|
||||
|
||||
query MethodBase lookupMethod(Module m, string name) { result = M::lookupMethod(m, name) }
|
||||
|
||||
Reference in New Issue
Block a user