Skip to content
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

Interactions of Content-Disposition with CSP-FA/XFO and Status Codes #9762

Open
JannisBush opened this issue Sep 20, 2023 · 2 comments
Open
Labels
security/privacy There are security or privacy implications security-tracker Group bringing to attention of security, or tracked by the security Group but not needing response. topic: fetch

Comments

@JannisBush
Copy link

Browsers currently diverge in their handling of Content-Disposition headers in combination with CSP or non-200 status codes.
The specification seems to be under-specified and missing tests in this area: https://html.spec.whatwg.org/#downloading-resources

Example differences:

  • iframe response with CD and CSP FA/XFO: WebKit blocks, Chromium/Firefox download
  • iframe response with CD and status code 3XX without a location header: Chromium blocks, WebKit prompts, Firefox opens a new tab
  • iframe response with CD and status code 205: Chromium prompts and fails, WebKit prompts, Firefox does not prompt

In general, it seems like the order/priority of headers and status codes is not principled and instead handled in an ad-hoc manner in the implementations. Thus, similar issues could probably be discovered for other header combinations and header/status code combinations as well.

@annevk annevk added security/privacy There are security or privacy implications topic: fetch security-tracker Group bringing to attention of security, or tracked by the security Group but not needing response. labels Sep 26, 2023
@annevk
Copy link
Member

annevk commented Sep 26, 2023

Generally, where we can get away with it I think we should block as early as possible. So headers that can cause blocking should be handled first.

Whether CD should work for non-2xx I'm not sure. Does it work for 404? Perhaps that should be its own issue.

@JannisBush
Copy link
Author

404 with CD seem to trigger a Download in WebKit, new tab in Gecko, and error page in Chromium.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
security/privacy There are security or privacy implications security-tracker Group bringing to attention of security, or tracked by the security Group but not needing response. topic: fetch
Development

No branches or pull requests

3 participants
@annevk @JannisBush and others