Skip to content

Commit 57508b2

Browse files
committed
ruby: Limit rack PotentialResponseNode to things that look like they occur in a rack application
1 parent b62a02f commit 57508b2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module App {
3030
AppCandidate() {
3131
call = this.getInstanceMethod("call") and
3232
call.getNumberOfParameters() = 1 and
33-
call.getReturn() = trackRackResponse(resp)
33+
call.getAReturningNode() = trackRackResponse(resp)
3434
}
3535

3636
/**

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ module Private {
1919

2020
class PotentialResponseNode extends DataFlow::ArrayLiteralNode {
2121
// [status, headers, body]
22-
PotentialResponseNode() { this.getNumberOfArguments() = 3 }
22+
PotentialResponseNode() {
23+
this.getNumberOfArguments() = 3 and
24+
this.asExpr().getExpr().getEnclosingModule+().getAMethod().getName() = "call"
25+
}
2326

2427
/**
2528
* Gets an HTTP status code that may be returned in this response.

0 commit comments

Comments
 (0)