-
Notifications
You must be signed in to change notification settings - Fork 22
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
Spec is not clear about blobs created in sandboxed iframes #41
Comments
That's an interesting case, there are several related issues here:
Assuming we want to allow fetching the blob URLs (and I think the idea was that these would be considered same origin with the opaque origin they are created in), I think Firefox's behavior makes the most sense. If the top-level browsing context is a secure context, it doesn't really make sense that a subpart of it would then no longer be. |
I originally reported this blob reading problem to safari at https://bugs.webkit.org/show_bug.cgi?id=170075 The root problem was that i was using I think at least that the document that created the blob in the first place should be allow to read its own blobs that it have created? I only used Blob since it can have a better memory handling. Should not the ObjectURL have the trustworthy flag instead to warn about mixed content warning? |
The issue is not about the blob object itself, but about the environment it creates. You cannot create an environment from a buffer. |
I agree that the intention is that blob URLs created in a opaque origin are same origin with the opaque origin they are created in. So yeah, agree that Firefox' behavior probably makes the most sense here. |
It is nice to see we can converge in that area. We have environments that are secure context, but whose origin is opaque, thus "Not Trustworthy". Or should we special case blob/filesystem URLs in https://w3c.github.io/webappsec-secure-contexts/#potentially-trustworthy-url to use the context URL and not the context origin? |
For secure contexts we created https://html.spec.whatwg.org/#secure-contexts which solve some problems it had except it itself has a problem for Is the problem that we cannot change https://w3c.github.io/webappsec-mixed-content/#categorize-settings-object to talk about secure contexts as that would not help (regress, even) with HTTPS nested inside HTTP? (By the way, note that this uses responsible document @domenic.) It does seem that for workers that could at least be changed to look at the owners of the worker in case of an opaque origin. Fusing it into the opaque origin is an interesting thought, but a decent undertaking as well. It might be more feasible these days though as we have a better handle on when these origins are created/assigned. @antosart's https://github.com/antosart/policy-container-explained might also help us formalize this better. (At least the refactoring that will require will make this easier I think.) |
I think one difficulty here is that the secure context bit of an environment is closely tied to its origin before sandboxing is applied, but there seems to be no good definition for that concept in the spec. What does the "creation URL" of a blob look like? That is what the current version in HTML bases decisions off of. |
Good point. That is broken as well. 😟 We should just set these things at creation-time. |
+1 to setting these at creation time. The problem then becomes that of plugging that setting logic into the spec for all kinds of policies - which the policy container can address. |
And to be clear I think we need two bits, right?
E.g., if you have sandboxed HTTPS inside HTTP it would have secure scheme (and mixed content restrictions), but not secure context (no nice APIs). |
That sounds correct. I'm no expert on mixed content though :) |
https://bugs.webkit.org/show_bug.cgi?id=170075 <rdar://problem/31282427> Reviewed by Alex Christensen. Source/WebCore: In case of blob with an opaque origin, get the document that created the blob and use the document for mixed content check. Further refactoring should be done once specs are updated to clarify this. See w3c/webappsec-mixed-content#41 for more information. Tests: http/wpt/fetch/blob-of-opaque-origin-iframe.html http/wpt/fetch/blob-of-opaque-origin-worker.html * loader/MixedContentChecker.cpp: (WebCore::MixedContentChecker::isMixedContent): LayoutTests: * http/wpt/fetch/blob-of-opaque-origin-iframe-expected.txt: Added. * http/wpt/fetch/blob-of-opaque-origin-iframe.html: Added. * http/wpt/fetch/blob-of-opaque-origin-worker-expected.txt: Added. * http/wpt/fetch/blob-of-opaque-origin-worker.html: Added. * platform/win/TestExpectations: Canonical link: https://commits.webkit.org/234840@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=170075 <rdar://problem/31282427> Reviewed by Alex Christensen. Source/WebCore: In case of blob with an opaque origin, get the document that created the blob and use the document for mixed content check. Further refactoring should be done once specs are updated to clarify this. See w3c/webappsec-mixed-content#41 for more information. Tests: http/wpt/fetch/blob-of-opaque-origin-iframe.html http/wpt/fetch/blob-of-opaque-origin-worker.html * loader/MixedContentChecker.cpp: (WebCore::MixedContentChecker::isMixedContent): LayoutTests: * http/wpt/fetch/blob-of-opaque-origin-iframe-expected.txt: Added. * http/wpt/fetch/blob-of-opaque-origin-iframe.html: Added. * http/wpt/fetch/blob-of-opaque-origin-worker-expected.txt: Added. * http/wpt/fetch/blob-of-opaque-origin-worker.html: Added. * platform/win/TestExpectations: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@273879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
A sandboxed srcrdoc iframe will have its origin as "null" so its origin will not be trustworthy but the iframe will be considered as secure context according https://w3c.github.io/webappsec-secure-contexts/#is-url-trustworthy.
If that iframe creates a blob, the blob URL will be something like "blob://null/UUID".
Applying https://w3c.github.io/webappsec-secure-contexts/#is-url-trustworthy to "blob://null/UUID", the URL should be considered as "Not Trustworthy". Trying to load that URL as iframe or worker should for instance trigger mixed content checks.
https://jsfiddle.net/fjvteqo5/ shows a difference of behaviour.
I am wondering what is behind the difference of behaviour between Safari and others.
Is it because blob://null/UUID in Safari is considered not trustworthy, while Chrome and Firefox are checking the context that created the blob?
I am also interested in hearing about Chrome/Firefox difference here.
The text was updated successfully, but these errors were encountered: