Skip to content

Commit 21ce9b4

Browse files
committed
Ruby: Attempt to fix performance of AppCandidate
`DataFlow::MethodNode.getAReturningNode` is expensive to compute. Instead we look for rack responses which flow to the `SynthReturnNode`. Each method has only one of these (vs many "returning" nodes) so it is a lot faster. I'm not sure yet whether the results are the same.
1 parent 16baea2 commit 21ce9b4

File tree

1 file changed

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

1 file changed

+1
-1
lines changed

ruby/ql/lib/codeql/ruby/frameworks/Rack.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module Rack {
2020
AppCandidate() {
2121
call = this.getInstanceMethod("call") and
2222
call.getNumberOfParameters() = 1 and
23-
isRackResponse(call.getAReturningNode())
23+
exists(DataFlow::LocalSourceNode resp | isRackResponse(resp) | resp.flowsTo(call.getReturn()))
2424
}
2525

2626
/**

0 commit comments

Comments
 (0)