Skip to content

Commit be1d4c3

Browse files
committed
Address comment
1 parent ade3669 commit be1d4c3

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

ql/src/codeql_ruby/ApiGraphs.qll

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,13 @@ module API {
297297
// pred = `Rails` part of `Rails::Whatever`
298298
// lbl = `Whatever`
299299
// ref = `Rails::Whatever`
300-
exists(ExprNodes::ConstantAccessCfgNode c, DataFlow::Node node |
301-
not exists(resolveScopeExpr(c.getExpr())) and
300+
exists(ExprNodes::ConstantAccessCfgNode c, DataFlow::Node node, ConstantReadAccess read |
301+
not exists(resolveScopeExpr(read)) and
302302
pred.flowsTo(node) and
303303
node.asExpr() = c.getScopeExpr() and
304-
lbl = Label::member(c.getExpr().getName()) and
305-
ref.asExpr() = c
304+
lbl = Label::member(read.getName()) and
305+
ref.asExpr() = c and
306+
read = c.getExpr()
306307
)
307308
or
308309
// Calling a method on a node that is a use of `base`
@@ -331,10 +332,11 @@ module API {
331332
*/
332333
cached
333334
predicate use(TApiNode nd, DataFlow::Node ref) {
334-
exists(string name, ExprNodes::ConstantAccessCfgNode access |
335+
exists(string name, ExprNodes::ConstantAccessCfgNode access, ConstantReadAccess read |
335336
access = ref.asExpr() and
336337
nd = MkModule(name) and
337-
TResolved(name) = resolveScopeExpr(access.getExpr())
338+
read = access.getExpr() and
339+
TResolved(name) = resolveScopeExpr(read)
338340
)
339341
or
340342
nd = MkUse(ref)

0 commit comments

Comments
 (0)