Skip to content

Commit f8ae530

Browse files
committed
Ruby: update Twirp
This used right-to-left evaluation for API graphs, which is not supported anymore
1 parent b305c13 commit f8ae530

1 file changed

Lines changed: 3 additions & 26 deletions

File tree

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

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,38 +21,15 @@ module Twirp {
2121
this = API::getTopLevelMember("Twirp").getMember("Service").getAnInstantiation()
2222
}
2323

24-
/**
25-
* Gets a local source node for the Service instantiation argument (the service handler).
26-
*/
27-
private DataFlow::LocalSourceNode getHandlerSource() {
28-
result = this.getArgument(0).getALocalSource()
29-
}
30-
31-
/**
32-
* Gets the API::Node for the service handler's class.
33-
*/
34-
private API::Node getAHandlerClassApiNode() {
35-
result.getAnInstantiation() = this.getHandlerSource()
36-
}
37-
38-
/**
39-
* Gets the AST module for the service handler's class.
40-
*/
41-
private Ast::Module getAHandlerClassAstNode() {
42-
result =
43-
this.getAHandlerClassApiNode()
44-
.asSource()
45-
.asExpr()
46-
.(CfgNodes::ExprNodes::ConstantReadAccessCfgNode)
47-
.getExpr()
48-
.getModule()
24+
private DataFlow::ClassNode getAHandlerClass() {
25+
result.getAnImmediateReference().getAMethodCall("new").flowsTo(this.getArgument(0))
4926
}
5027

5128
/**
5229
* Gets a handler's method.
5330
*/
5431
Ast::Method getAHandlerMethod() {
55-
result = this.getAHandlerClassAstNode().getAnInstanceMethod()
32+
result = this.getAHandlerClass().getAnAncestor().getAnOwnInstanceMethod().asCallableAstNode()
5633
}
5734
}
5835

0 commit comments

Comments
 (0)