Skip to content

Commit de09d59

Browse files
committed
Refine more on req.http.req
1 parent bb57c22 commit de09d59

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

javascript/frameworks/cap/lib/advanced_security/javascript/frameworks/cap/RemoteFlowSources.qll

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,14 @@ class HandlerParameterOfExposedService extends HandlerParameter {
4040
* - `req.data` (from `cds.Event.data`)
4141
* - `req.params` (from `cds.Request.params`)
4242
* - `req.headers` (from `cds.Event.headers`)
43-
* - `req.http.req` (from `cds.EventContext.http.req`)
43+
* - `req.http.req.*` (from `cds.EventContext.http.req`)
4444
* - `req.id` (from `cds.EventContext.id`)
45+
*
46+
* Note that `req.http.req` has type `require("@express").Request`, so their uses are
47+
* completely identical. Subsequently, the models for this access path follow Express'
48+
* API descriptions (as far as 3.x). Also see `Express::RequestInputAccess`,
49+
* `Express::RequestHeaderAccess`, and `Express::RequestBodyAccess` of the standard
50+
* library.
4551
*/
4652
class UserProvidedPropertyReadOfHandlerParameterOfExposedService extends RemoteFlowSource instanceof PropRead
4753
{
@@ -51,8 +57,17 @@ class UserProvidedPropertyReadOfHandlerParameterOfExposedService extends RemoteF
5157
/* 1. `req.(data|params|headers|id)` */
5258
this = handlerParameterOfExposedService.getAPropertyRead(["data", "params", "headers", "id"])
5359
or
54-
/* 2. `req.http.req` */
55-
this = handlerParameterOfExposedService.getAPropertyRead("http").getAPropertyRead("req")
60+
/* 2. APIs stemming from `req.http.req`: Defined by Express.js */
61+
exists(PropRead reqHttpReq |
62+
reqHttpReq = handlerParameterOfExposedService.getAPropertyRead("http").getAPropertyRead("req")
63+
|
64+
this = reqHttpReq.getAPropertyRead(["originalUrl", "hostname"]) or
65+
this =
66+
reqHttpReq
67+
.getAPropertyRead(["query", "body", "params", "headers", "cookies"])
68+
.getAPropertyRead() or
69+
this = reqHttpReq.getAMemberCall(["get", "is", "header", "param"])
70+
)
5671
}
5772

5873
HandlerParameterOfExposedService getHandlerParameter() {

0 commit comments

Comments
 (0)