@@ -464,16 +464,23 @@ module Express {
464
464
}
465
465
466
466
/**
467
- * Gets a reference to the "query" or "params" object from a request-object originating from route-handler `rh`.
467
+ * Gets a reference to the "query" object from a request-object originating from route-handler `rh`.
468
468
*/
469
- DataFlow:: SourceNode getAQueryObjectReference (
470
- DataFlow:: TypeTracker t , RouteHandler rh , string prop
471
- ) {
472
- prop = [ "params" , "query" ] and
473
- t .startInProp ( prop ) and
469
+ DataFlow:: SourceNode getAQueryObjectReference ( DataFlow:: TypeTracker t , RouteHandler rh ) {
470
+ t .startInProp ( "query" ) and
474
471
result = rh .getARequestSource ( )
475
472
or
476
- exists ( DataFlow:: TypeTracker t2 | result = getAQueryObjectReference ( t2 , rh , prop ) .track ( t2 , t ) )
473
+ exists ( DataFlow:: TypeTracker t2 | result = getAQueryObjectReference ( t2 , rh ) .track ( t2 , t ) )
474
+ }
475
+
476
+ /**
477
+ * Gets a reference to the "params" object from a request-object originating from route-handler `rh`.
478
+ */
479
+ DataFlow:: SourceNode getAParamsObjectReference ( DataFlow:: TypeTracker t , RouteHandler rh ) {
480
+ t .startInProp ( "params" ) and
481
+ result = rh .getARequestSource ( )
482
+ or
483
+ exists ( DataFlow:: TypeTracker t2 | result = getAParamsObjectReference ( t2 , rh ) .track ( t2 , t ) )
477
484
}
478
485
479
486
/**
@@ -485,7 +492,9 @@ module Express {
485
492
486
493
RequestInputAccess ( ) {
487
494
kind = "parameter" and
488
- this = getAQueryObjectReference ( DataFlow:: TypeTracker:: end ( ) , rh , _) .getAPropertyRead ( )
495
+ this =
496
+ [ getAQueryObjectReference ( DataFlow:: TypeTracker:: end ( ) , rh ) ,
497
+ getAParamsObjectReference ( DataFlow:: TypeTracker:: end ( ) , rh ) ] .getAPropertyRead ( )
489
498
or
490
499
exists ( DataFlow:: SourceNode request | request = rh .getARequestSource ( ) .ref ( ) |
491
500
kind = "parameter" and
@@ -534,7 +543,7 @@ module Express {
534
543
or
535
544
// `req.query.name`
536
545
kind = "parameter" and
537
- this = getAQueryObjectReference ( DataFlow:: TypeTracker:: end ( ) , rh , "query" ) .getAPropertyRead ( )
546
+ this = getAQueryObjectReference ( DataFlow:: TypeTracker:: end ( ) , rh ) .getAPropertyRead ( )
538
547
}
539
548
}
540
549
0 commit comments