Open Bug 1512965 Opened 7 years ago Updated 2 years ago

Tainted "no-cors" <img> / <script> should be treated as cross-origin

Categories

(Core :: DOM: Networking, defect, P2)

defect

Tracking

()

People

(Reporter: annevk, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

Basically, when the request chain for a "no-cors" subresource on a document with origin A is A -> B -> A, the behavior should be as if the subresource came from B. That is, trying to read image data should throw and script exceptions are to be muted. There might be some other endpoints affected here, but thus far there's only tests for these: * https://github.com/web-platform-tests/wpt/pull/14112 * https://github.com/web-platform-tests/wpt/pull/14218 Chrome and Safari do the right thing here.
This is already the case for scripts, fwiw: muting is and always has been based on the original request URI, not the response URI. Are there other cases that matter here? Stylesheets? Anything else?
Actually, maybe what I said about muting there is just wrong. It wouldn't make any sense for same-origin loads that then redirect cross-origin...
What is already the case? (Note that we fail the script test.) The general issue might also affect media, stylesheets, and maybe plugins? fetch() too, but we already do it correct there. I'm unclear on the testing situation for media, stylesheets, and plugins. https://github.com/whatwg/fetch/issues/737 tracks the general issue as far as testing and prose in the relevant standards is concerned.
Yes, I was wrong. Muting is currently just based on the origin of the final response. Also, muting seems to work quite differently in Gecko and in the spec (e.g. Gecko only mutes actual Error instances, because that's where the muting information lives, and the tests throw strings, so Gecko does not pass the tests no matter what behavior we implement for the case this actually exists to address: syntax errors).
(It would be useful to have tests that actually test the thing that muting is supposed to address, by the way.)
Priority: -- → P2
Whiteboard: [necko-triaged]
See Also: → 1599950
Type: enhancement → defect
See Also: → 1648828
Severity: normal → S3
Blocks: necko-cors
You need to log in before you can comment on or make changes to this bug.