File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
javascript/ql/src/semmle/javascript/frameworks Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -463,6 +463,16 @@ module Express {
463
463
override RequestSource src ;
464
464
}
465
465
466
+ /**
467
+ * Gets a reference to the "query" or "params" object from a request-object originating from route-handler `rh`.
468
+ */
469
+ DataFlow:: SourceNode getAQueryObjectReference ( DataFlow:: TypeTracker t , RouteHandler rh ) {
470
+ t .startInProp ( [ "params" , "query" ] ) and
471
+ result = rh .getARequestSource ( )
472
+ or
473
+ exists ( DataFlow:: TypeTracker t2 | result = getAQueryObjectReference ( t2 , rh ) .track ( t2 , t ) )
474
+ }
475
+
466
476
/**
467
477
* An access to a user-controlled Express request input.
468
478
*/
@@ -471,13 +481,12 @@ module Express {
471
481
string kind ;
472
482
473
483
RequestInputAccess ( ) {
484
+ kind = "parameter" and
485
+ this = getAQueryObjectReference ( DataFlow:: TypeTracker:: end ( ) , rh ) .getAPropertyRead ( )
486
+ or
474
487
exists ( DataFlow:: SourceNode request | request = rh .getARequestSource ( ) .ref ( ) |
475
488
kind = "parameter" and
476
- (
477
- this = request .getAMethodCall ( "param" )
478
- or
479
- this = request .getAPropertyRead ( [ "params" , "query" ] ) .getAPropertyRead ( )
480
- )
489
+ this = request .getAMethodCall ( "param" )
481
490
or
482
491
// `req.originalUrl`
483
492
kind = "url" and
You can’t perform that action at this time.
0 commit comments