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

Reinvestigate redirects to data URLs #393

Closed
annevk opened this issue Sep 30, 2016 · 7 comments
Closed

Reinvestigate redirects to data URLs #393

annevk opened this issue Sep 30, 2016 · 7 comments

Comments

@annevk
Copy link
Member

annevk commented Sep 30, 2016

I managed to flip on this several times in the course of #111, the last time due to investigations in how navigate works in #309. I think my mistake might have been that I did not investigate "no-cors", as redirects to data URLs still work there in (some) implementations and lead to the response being treated as CORS-cross-origin (HTML's term).

Related tests that might need updating:

Thanks to @youennf for finding this.

@annevk
Copy link
Member Author

annevk commented Oct 12, 2016

Also copying @bzbarsky @mikewest due to recent data URL changes in Fetch and HTML they were involved in.

Would any redirect to a data URL make it qualify as being CORS-cross-origin, or only if the redirect was found on another origin?

@bzbarsky
Copy link

Would any redirect to a data URL make it qualify as being CORS-cross-origin

I think in Gecko any redirect to a data URL is considered CORS-cross-origin.

@annevk
Copy link
Member Author

annevk commented Sep 4, 2017

Chrome does seem to consistently fail for redirects to data URLs. E.g., adding

<script src=../resources/redirect.py?location=data:,alert(1) onerror=alert('error')></script>

to fetch/api/redirect/redirect-schemes.html in web-platform-tests alerts "error", whereas Firefox and Safari alert "1".

Not sure what we want to align on here.

Firefox is the only browser to follow redirects to data URLs consistently by failing several of the tests in fetch/api/redirect/redirect-to-dataurl.html. It seems that other browsers have special cases for fetch() which would end up showing if you used a service worker.

@annevk
Copy link
Member Author

annevk commented Sep 4, 2017

I also tested with

<img src="../resources/redirect.py?location=data:image/png%3Bbase64,iVBORw0KGgoAAAANSUhEUgAAAIUAAABqCAIAAAAdqgU8AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAF6SURBVHhe7dNBDQAADIPA%2Bje92eBxSQUQSLedlQzo0TLQonFWPVoGWjT%2BoUfLQIvGP/RoGWjR%2BIceLQMtGv/Qo2WgReMferQMtGj8Q4%2BWgRaNf%2BjRMtCi8Q89WgZaNP6hR8tAi8Y/9GgZaNH4hx4tAy0a/9CjZaBF4x96tAy0aPxDj5aBFo1/6NEy0KLxDz1aBlo0/qFHy0CLxj/0aBlo0fiHHi0DLRr/0KNloEXjH3q0DLRo/EOPloEWjX/o0TLQovEPPVoGWjT%2BoUfLQIvGP/RoGWjR%2BIceLQMtGv/Qo2WgReMferQMtGj8Q4%2BWgRaNf%2BjRMtCi8Q89WgZaNP6hR8tAi8Y/9GgZaNH4hx4tAy0a/9CjZaBF4x96tAy0aPxDj5aBFo1/6NEy0KLxDz1aBlo0/qFHy0CLxj/0aBlo0fiHHi0DLRr/0KNloEXjH3q0DLRo/EOPloEWjX/o0TLQovEPPVoGWjT%2BoUfLQIvGP/RoGWjR%2BIceJQMPIOzeGc0PIDEAAAAASUVORK5CYII" alt=oops>

which gave identical results.

@toyoshim
Copy link

toyoshim commented Apr 3, 2019

I reached this thread during a bug triage for the Chrome Loading team.

At this moment, we don't focus on this topic, but if there is an update on this thread, please contact us via the following entry.
https://bugs.chromium.org/p/chromium/issues/detail?id=527326

annevk added a commit to web-platform-tests/wpt that referenced this issue Feb 3, 2021
@annevk
Copy link
Member Author

annevk commented Feb 3, 2021

I finally created a PR for the demos above at web-platform-tests/wpt#27463. @youennf I'm inclined to uphold the current standard and not allow redirects to data: URLs as far as the fetch algorithm is concerned. They are still supposed to work for navigations as those handle redirects on their own.

annevk added a commit to web-platform-tests/wpt that referenced this issue Feb 9, 2021
@annevk
Copy link
Member Author

annevk commented Feb 9, 2021

@annevk annevk closed this as completed Feb 9, 2021
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Feb 12, 2021
Automatic update from web-platform-tests
Fetch: redirects to data: URLs

For whatwg/fetch#393.
--

wpt-commits: 0cae3be3b2ba254b0cf40858b8cea6c7156090d7
wpt-pr: 27463
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Feb 12, 2021
Automatic update from web-platform-tests
Fetch: redirects to data: URLs

For whatwg/fetch#393.
--

wpt-commits: 0cae3be3b2ba254b0cf40858b8cea6c7156090d7
wpt-pr: 27463
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Feb 16, 2021
Automatic update from web-platform-tests
Fetch: redirects to data: URLs

For whatwg/fetch#393.
--

wpt-commits: 0cae3be3b2ba254b0cf40858b8cea6c7156090d7
wpt-pr: 27463

UltraBlame original commit: 0801f11d7e9c8a57cffb42cff0e04bc1e1e77a08
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Feb 16, 2021
Automatic update from web-platform-tests
Fetch: redirects to data: URLs

For whatwg/fetch#393.
--

wpt-commits: 0cae3be3b2ba254b0cf40858b8cea6c7156090d7
wpt-pr: 27463

UltraBlame original commit: 809a45d0ebe9152c041f7cf8f38d478605ef6c4b
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Feb 16, 2021
Automatic update from web-platform-tests
Fetch: redirects to data: URLs

For whatwg/fetch#393.
--

wpt-commits: 0cae3be3b2ba254b0cf40858b8cea6c7156090d7
wpt-pr: 27463

UltraBlame original commit: 0801f11d7e9c8a57cffb42cff0e04bc1e1e77a08
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Feb 16, 2021
Automatic update from web-platform-tests
Fetch: redirects to data: URLs

For whatwg/fetch#393.
--

wpt-commits: 0cae3be3b2ba254b0cf40858b8cea6c7156090d7
wpt-pr: 27463

UltraBlame original commit: 809a45d0ebe9152c041f7cf8f38d478605ef6c4b
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Feb 16, 2021
Automatic update from web-platform-tests
Fetch: redirects to data: URLs

For whatwg/fetch#393.
--

wpt-commits: 0cae3be3b2ba254b0cf40858b8cea6c7156090d7
wpt-pr: 27463

UltraBlame original commit: 0801f11d7e9c8a57cffb42cff0e04bc1e1e77a08
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Feb 16, 2021
Automatic update from web-platform-tests
Fetch: redirects to data: URLs

For whatwg/fetch#393.
--

wpt-commits: 0cae3be3b2ba254b0cf40858b8cea6c7156090d7
wpt-pr: 27463

UltraBlame original commit: 809a45d0ebe9152c041f7cf8f38d478605ef6c4b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants