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

Origin of blob: documents doesn't match implementations #2759

Open
bzbarsky opened this issue Jun 14, 2017 · 5 comments
Open

Origin of blob: documents doesn't match implementations #2759

bzbarsky opened this issue Jun 14, 2017 · 5 comments
Labels
topic: origin topic: policy container The policy container proposal

Comments

@bzbarsky
Copy link
Contributor

What is the origin of a document loaded from a blob: URL without sandboxing?

Stepping through the "For Document objects" list at https://html.spec.whatwg.org/multipage/origin.html#origin (sadly no direct way to link it):

  1. No sandboxing, does not apply.
  2. URL is not data:, does not apply.
  3. Scheme is not a network scheme, does not apply.
  4. Not about:blank, does not apply.
  5. Not about:blank, does not apply.
  6. Not javascript:, does not apply.
  7. Not srcdoc, does not apply.
  8. Fall through to DOM behavior, give it a unique origin.

Needless to say, this is not how blob: actually works in browsers, nor how anyone expects it to work. @mikewest @annevk @domenic

What Gecko does in practice is that when you create a Blob URL the association from url to Blob includes an association to the origin of the thing that created the blob, I believe. The load from the blob: URL gets that origin. In particular, if you load a subframe from a blob: URL and then set document.domain (or do it in the opposite order, either way) you are still "same origin-domain" with the blob: thing you loaded. Note that this is not the same thing as javascript: and about:blank origin inheritance, but similar.

@domenic
Copy link
Member

domenic commented Jun 14, 2017

This seems to fit into a general known issue, although I'm not sure people have specifically understood the sandboxing case before:

@mkruisselbrink

It really would be good to get this fixed.

@bzbarsky
Copy link
Contributor Author

Oh, sandboxing was explicitly brought up in those issues. I wish we had an actual searchable issue database; right now just finding which repo issues are reported against is a total guess. :(

@domenic
Copy link
Member

domenic commented Jun 14, 2017

I mean, this is somewhat of a special case as the definition of origin of URL is spread across two specs right now. Over time we should be able to consolidate that into one.

Not sure about how or whether we can deal with the definition of "origin" in general being spread out across HTML/URL/DOM though. I guess I have some ideas but I'll move them to another thread...

@bzbarsky
Copy link
Contributor Author

Also, it sort of fits into that issue, but note that the basic problem here is that we never even reach the "origin of the URL" bit at all here.

A second problem is that even if we did that might not match UAs in terms of document.domain handling. It looks like I have a testcase written for it already, so maybe I even filed it before... http://web.mit.edu/bzbarsky/www/testcases/security/blob-iframe-document-domain.html shows that Firefox treats the blob: as same origin-domain but Chrome does not. So I'm really not sure what Chrome implements exactly, and in particular how it manages to have nonce origins match but apparently without it being the same origin in general (because the document.domain bits don't match)?

@mikewest
Copy link
Member

Hrm. It looks like Chrome is doing the wrong thing here; I agree with @bzbarsky that we ought to be following Firefox's behavior here; I haven't looked at the code, but I assume we're just creating a new origin object rather than aliasing the existing origin, so the domain check fails. Filed https://bugs.chromium.org/p/chromium/issues/detail?id=733351 to track.

@annevk annevk added the topic: policy container The policy container proposal label Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: origin topic: policy container The policy container proposal
Development

No branches or pull requests

4 participants