File tree Expand file tree Collapse file tree
javascript/ql/src/semmle/javascript/frameworks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -240,14 +240,22 @@ module HTTP {
240240 */
241241 private predicate isDecoratedCall ( DataFlow:: CallNode call , DataFlow:: FunctionNode decoratee ) {
242242 // indirect route-handler `result` is given to function `outer`, which returns function `inner` which calls the function `pred`.
243- exists ( int i , Function outer , Function inner |
243+ exists ( int i , DataFlow :: FunctionNode outer , HTTP :: RouteHandlerCandidate inner |
244244 decoratee = call .getArgument ( i ) .getALocalSource ( ) and
245- outer = call .getACallee ( ) and
246- inner = outer . getAReturnedExpr ( ) and
247- isAForwardingRouteHandlerCall ( DataFlow :: parameterNode ( outer .getParameter ( i ) ) , inner . flow ( ) )
245+ outer . getFunction ( ) = call .getACallee ( ) and
246+ outer = returnsARouteHandler ( inner ) and
247+ isAForwardingRouteHandlerCall ( outer .getParameter ( i ) , inner )
248248 )
249249 }
250250
251+ /**
252+ * Gets a function that returns the route-handler-candidate `routeHandler`.
253+ */
254+ pragma [ noinline]
255+ private DataFlow:: FunctionNode returnsARouteHandler ( HTTP:: RouteHandlerCandidate routeHandler ) {
256+ routeHandler = result .getAReturn ( ) .getALocalSource ( )
257+ }
258+
251259 /**
252260 * 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.
253261 */
You can’t perform that action at this time.
0 commit comments