@@ -466,11 +466,14 @@ module Express {
466466 /**
467467 * Gets a reference to the "query" or "params" object from a request-object originating from route-handler `rh`.
468468 */
469- DataFlow:: SourceNode getAQueryObjectReference ( DataFlow:: TypeTracker t , RouteHandler rh ) {
470- t .startInProp ( [ "params" , "query" ] ) and
469+ DataFlow:: SourceNode getAQueryObjectReference (
470+ DataFlow:: TypeTracker t , RouteHandler rh , string prop
471+ ) {
472+ prop = [ "params" , "query" ] and
473+ t .startInProp ( prop ) and
471474 result = rh .getARequestSource ( )
472475 or
473- exists ( DataFlow:: TypeTracker t2 | result = getAQueryObjectReference ( t2 , rh ) .track ( t2 , t ) )
476+ exists ( DataFlow:: TypeTracker t2 | result = getAQueryObjectReference ( t2 , rh , prop ) .track ( t2 , t ) )
474477 }
475478
476479 /**
@@ -482,7 +485,7 @@ module Express {
482485
483486 RequestInputAccess ( ) {
484487 kind = "parameter" and
485- this = getAQueryObjectReference ( DataFlow:: TypeTracker:: end ( ) , rh ) .getAPropertyRead ( )
488+ this = getAQueryObjectReference ( DataFlow:: TypeTracker:: end ( ) , rh , _ ) .getAPropertyRead ( )
486489 or
487490 exists ( DataFlow:: SourceNode request | request = rh .getARequestSource ( ) .ref ( ) |
488491 kind = "parameter" and
@@ -527,13 +530,11 @@ module Express {
527530 kind = "parameter" and
528531 exists ( DataFlow:: Node request | request = DataFlow:: valueNode ( rh .getARequestExpr ( ) ) |
529532 this .( DataFlow:: MethodCallNode ) .calls ( request , "param" )
530- or
531- exists ( DataFlow:: PropRead base |
532- // `req.query.name`
533- base .accesses ( request , "query" ) and
534- this = base .getAPropertyReference ( _)
535- )
536533 )
534+ or
535+ // `req.query.name`
536+ kind = "parameter" and
537+ this = getAQueryObjectReference ( DataFlow:: TypeTracker:: end ( ) , rh , "query" ) .getAPropertyRead ( )
537538 }
538539 }
539540
0 commit comments