File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
javascript/ql/src/semmle/javascript/frameworks Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -167,12 +167,8 @@ module Koa {
167167 kind = "body" and
168168 this .asExpr ( ) .( PropAccess ) .accesses ( request , "body" )
169169 or
170- exists ( PropAccess query |
171- kind = "parameter" and
172- // `ctx.request.query.name`
173- query .accesses ( request , "query" ) and
174- this .asExpr ( ) .( PropAccess ) .accesses ( query , _)
175- )
170+ kind = "parameter" and
171+ this = getAQueryParameterAccess ( rh )
176172 or
177173 exists ( string propName |
178174 // `ctx.request.url`, `ctx.request.originalUrl`, or `ctx.request.href`
@@ -203,6 +199,16 @@ module Koa {
203199 override string getKind ( ) {
204200 result = kind
205201 }
202+
203+ override predicate isUserControlledObject ( ) {
204+ this = getAQueryParameterAccess ( rh )
205+ }
206+
207+ }
208+
209+ private DataFlow:: Node getAQueryParameterAccess ( RouteHandler rh ) {
210+ // `ctx.request.query.name`
211+ result .asExpr ( ) .( PropAccess ) .getBase ( ) .( PropAccess ) .accesses ( rh .getARequestExpr ( ) , "query" )
206212 }
207213
208214 /**
You can’t perform that action at this time.
0 commit comments