File tree Expand file tree Collapse file tree 3 files changed +28
-6
lines changed
javascript/ql/lib/semmle/javascript Expand file tree Collapse file tree 3 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -419,6 +419,8 @@ module Routing {
419
419
or
420
420
HTTP:: routeHandlerStep ( result , this )
421
421
or
422
+ RouteHandlerTrackingStep:: step ( result , this )
423
+ or
422
424
exists ( string prop |
423
425
StepSummary:: smallstep ( result , getSourceProp ( prop ) .getALocalUse ( ) , StoreStep ( prop ) )
424
426
)
@@ -496,6 +498,22 @@ module Routing {
496
498
}
497
499
}
498
500
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
+
499
517
/**
500
518
* A node in the routing tree which has no parent.
501
519
*/
Original file line number Diff line number Diff line change @@ -404,4 +404,14 @@ module Fastify {
404
404
)
405
405
}
406
406
}
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
+ }
407
417
}
Original file line number Diff line number Diff line change @@ -234,12 +234,6 @@ module HTTP {
234
234
or
235
235
// references to class methods
236
236
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
- )
243
237
}
244
238
245
239
/**
You can’t perform that action at this time.
0 commit comments