Skip to content

Commit ecd0ce6

Browse files
committed
Refactor GrapeHeadersBlockCall and GrapeCookiesBlockCall to simplify method call checks
1 parent b837c56 commit ecd0ce6

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,8 @@ module Grape {
237237
*/
238238
private class GrapeHeadersBlockCall extends MethodCall {
239239
GrapeHeadersBlockCall() {
240-
exists(GrapeApiClass api |
241-
this.getParent+() = api.getADeclaration() and
242-
this.getMethodName() = "headers" and
243-
exists(this.getBlock())
244-
)
240+
this = grapeApiInstance().getAMethodCall("headers").asExpr().getExpr() and
241+
exists(this.getBlock())
245242
}
246243
}
247244

@@ -251,11 +248,8 @@ module Grape {
251248
*/
252249
private class GrapeCookiesBlockCall extends MethodCall {
253250
GrapeCookiesBlockCall() {
254-
exists(GrapeApiClass api |
255-
this.getParent+() = api.getADeclaration() and
256-
this.getMethodName() = "cookies" and
257-
exists(this.getBlock())
258-
)
251+
this = grapeApiInstance().getAMethodCall("cookies").asExpr().getExpr() and
252+
exists(this.getBlock())
259253
}
260254
}
261255

0 commit comments

Comments
 (0)