Skip to content

Commit bdf1aa0

Browse files
authored
Merge pull request github#13746 from asgerf/rb/fix-rack-todo
Ruby: Use API graphs asCallable() instead of Proc.new workaround
2 parents d89c10d + 2962727 commit bdf1aa0

File tree

1 file changed

+1
-10
lines changed
  • ruby/ql/lib/codeql/ruby/frameworks/rack/internal

1 file changed

+1
-10
lines changed

ruby/ql/lib/codeql/ruby/frameworks/rack/internal/App.qll

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,7 @@ private class PotentialRequestHandler extends DataFlow::CallableNode {
1818
(
1919
this.(DataFlow::MethodNode).getMethodName() = "call"
2020
or
21-
not this instanceof DataFlow::MethodNode and
22-
exists(DataFlow::CallNode cn | cn.getMethodName() = "run" |
23-
this.(DataFlow::LocalSourceNode).flowsTo(cn.getArgument(0))
24-
or
25-
// TODO: `Proc.new` should automatically propagate flow from its block argument
26-
any(DataFlow::CallNode proc |
27-
proc = API::getTopLevelMember("Proc").getAnInstantiation() and
28-
proc.getBlock() = this
29-
).(DataFlow::LocalSourceNode).flowsTo(cn.getArgument(0))
30-
)
21+
this = API::getTopLevelCall("run").getArgument(0).asCallable()
3122
)
3223
}
3324
}

0 commit comments

Comments
 (0)