mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
improve join-order for HTTP::isDecoratedCall
This commit is contained in:
@@ -240,14 +240,22 @@ module HTTP {
|
||||
*/
|
||||
private predicate isDecoratedCall(DataFlow::CallNode call, DataFlow::FunctionNode decoratee) {
|
||||
// indirect route-handler `result` is given to function `outer`, which returns function `inner` which calls the function `pred`.
|
||||
exists(int i, Function outer, Function inner |
|
||||
exists(int i, DataFlow::FunctionNode outer, HTTP::RouteHandlerCandidate inner |
|
||||
decoratee = call.getArgument(i).getALocalSource() and
|
||||
outer = call.getACallee() and
|
||||
inner = outer.getAReturnedExpr() and
|
||||
isAForwardingRouteHandlerCall(DataFlow::parameterNode(outer.getParameter(i)), inner.flow())
|
||||
outer.getFunction() = call.getACallee() and
|
||||
outer = returnsARouteHandler(inner) and
|
||||
isAForwardingRouteHandlerCall(outer.getParameter(i), inner)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a function that returns the route-handler-candidate `routeHandler`.
|
||||
*/
|
||||
pragma[noinline]
|
||||
private DataFlow::FunctionNode returnsARouteHandler(HTTP::RouteHandlerCandidate routeHandler) {
|
||||
routeHandler = result.getAReturn().getALocalSource()
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `f` looks like a route-handler and a call to `callee` inside `f` forwards all of the parameters from `f` to that call.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user