JS: recognize Express headers as RequestInputAccess

This commit is contained in:
Asger F
2018-09-21 18:37:03 +01:00
parent 7f56be6fe2
commit ce11b5330d
3 changed files with 20 additions and 0 deletions

View File

@@ -479,6 +479,17 @@ module Express {
methodName = "header"
)
or
exists (DataFlow::PropRead headers |
// `req.headers.name`
kind = "header" and
headers.accesses(request, "headers") and
this = headers.getAPropertyRead(_))
or
exists (string propName | propName = "host" or propName = "hostname" |
// `req.host` and `req.hostname` are derived from headers
kind = "header" and
this.(DataFlow::PropRead).accesses(request, propName))
or
// `req.cookies`
kind = "cookie" and
this.(DataFlow::PropRef).accesses(request, "cookies")