JS: Add sinks for calls to 'new Response()' #19200
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Recognizes the
x
innew Response(x)
as aResponseSendArgument
; the main effect is that it becomes a sink for reflected XSS.Our HTTP model assumes each
ResponseSendArgument
has an associatedRouteHandler
and we use that to identify related header definitions. This meant it was not possible to associate aResponseSendArgument
with its header definitions if they did not have the same route handler.But for calls like
new Response(body, { headers })
the headers are fairly obvious whereas the route handler is unnecessarily hard to find. So this PR also extends the HTTP model a bit to better account for sinks where we can use the direct and obvious association between 'body' and 'headers' in the call.