Skip to content

JS: Add sinks for calls to 'new Response()' #19200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 10, 2025
Merged

Conversation

asgerf
Copy link
Contributor

@asgerf asgerf commented Apr 2, 2025

Recognizes the x in new Response(x) as a ResponseSendArgument; the main effect is that it becomes a sink for reflected XSS.

Our HTTP model assumes each ResponseSendArgument has an associated RouteHandler and we use that to identify related header definitions. This meant it was not possible to associate a ResponseSendArgument 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.

@github-actions github-actions bot added the JS label Apr 2, 2025
asgerf added 2 commits April 3, 2025 11:08
Previously it was not possible to associate a ResponseSendArgument 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 we use the direct and obvious association between 'body' and 'headers' in the call.
@asgerf asgerf force-pushed the js/web-response branch from 1d4e348 to 6c33013 Compare April 3, 2025 09:09
@asgerf asgerf marked this pull request as ready for review April 9, 2025 09:28
@asgerf asgerf requested a review from a team as a code owner April 9, 2025 09:28
Copy link
Contributor

@Napalys Napalys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. :shipit:

@asgerf asgerf merged commit eac14b9 into github:main Apr 10, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants