File tree Expand file tree Collapse file tree
javascript/ql/lib/semmle/javascript Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -419,6 +419,8 @@ module Routing {
419419 or
420420 HTTP:: routeHandlerStep ( result , this )
421421 or
422+ RouteHandlerTrackingStep:: step ( result , this )
423+ or
422424 exists ( string prop |
423425 StepSummary:: smallstep ( result , getSourceProp ( prop ) .getALocalUse ( ) , StoreStep ( prop ) )
424426 )
@@ -496,6 +498,22 @@ module Routing {
496498 }
497499 }
498500
501+ /**
502+ * An edge that should be used for tracking route handler definitions to their use-sites.
503+ *
504+ * This may be subclassed by framework models to contribute additional steps.
505+ */
506+ class RouteHandlerTrackingStep extends Unit {
507+ /** Holds if route handlers should be propagated along the edge `pred -> succ`. */
508+ predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) { none ( ) }
509+ }
510+
511+ private module RouteHandlerTrackingStep {
512+ predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
513+ any ( RouteHandlerTrackingStep s ) .step ( pred , succ )
514+ }
515+ }
516+
499517 /**
500518 * A node in the routing tree which has no parent.
501519 */
Original file line number Diff line number Diff line change @@ -404,4 +404,14 @@ module Fastify {
404404 )
405405 }
406406 }
407+
408+ private class RouteHandlerTracking extends Routing:: RouteHandlerTrackingStep {
409+ override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
410+ exists ( DataFlow:: CallNode call |
411+ call = DataFlow:: moduleImport ( "fastify-plugin" ) and
412+ pred = call .getArgument ( 0 ) and
413+ succ = call
414+ )
415+ }
416+ }
407417}
Original file line number Diff line number Diff line change @@ -234,12 +234,6 @@ module HTTP {
234234 or
235235 // references to class methods
236236 succ = CallGraph:: callgraphStep ( pred , DataFlow:: TypeTracker:: end ( ) )
237- or
238- exists ( DataFlow:: CallNode call |
239- call = DataFlow:: moduleImport ( "fastify-plugin" ) and
240- pred = call .getArgument ( 0 ) and
241- succ = call
242- )
243237 }
244238
245239 /**
You can’t perform that action at this time.
0 commit comments