-
Notifications
You must be signed in to change notification settings - Fork 8
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
Support mixed-content opaque stream fetches #56
Comments
I think that's basically the suggestion, yes. It's not clear to me all browsers are on board with this plan, but that's the proposal from Google. At the moment though Fetch would return null for |
+@wanderview fyi |
Is there any definition of what an opaque stream is? Its hard to understand what this issue is asking for without at least a sketch of the opaque stream behavior. Wouldn't an alternative be to allow MSE consume Response objects directly? You could then pass an opaque Response directly to MSE. |
@wolenetz, can you answer @wanderview's question? |
https://w3c.github.io/webappsec-credential-management/#monkey-patching-fetch-2 adds "opaque" flag to Request, but I think opaque streams can be used for such a case, too. @mikewest, what do you think about it? |
I would still like some definition of what an "opaque stream" is. |
From IRC: 12:19 PM wanderview: btw, opaque stream is basically a stream for all intents and purposes but only privileged code (read: the user agent) gets to see the bytes |
If we allow opaque streams, then this would need to fail:
And probably lots of other opaque tainting issues to be discovered. |
wolenetz explained thoughts on appendRespones() vs. appendStream() in this post to public-webappsec: |
If that is really the only use case, |
One point I'm not sure yet is, ... it seems to me that opaqueness for CORS and MIX (here) are slightly different. Opaqueness for CORS response tainting must be strict so that no one can uncover the contents which the server didn't allow to provide to cross-origin scripts. Opaqueness for MIX is protecting developers from easily using unreliable (possibly forged) subresource, and so the wall doesn't have to be high as one for CORS, right? Can we really converge these different opaqueness concept and protect by single opaqueness flag (the requirement for CORS is stronger so we can use it for MIX too)? Won't we want to distinguish them in the future?
Yea... I also agree with yhirano's point about possible composition of streams to process bytes without right to read the actual bytes. We were also discussing how to implement equivalent of "img.src=URL.createObjectURL(blob)" for streams. We initially sketched it like:
But e.g. to make it able to use no-cors results, someone said maybe it should be |
I'm not sure what you mean by opaqueness for CORS. A "cors" response has very limited opaqueness (just around headers). If you mean "no-cors", i.e. cross-origin resources without CORS, those are equivalent to MIX, since both are cross-origin. MIX is worse of course, since it's a worse legacy security bug that is hard to get rid of. (As for |
Yes, no-cors. Sorry for being unclear.
Ah! I see. I was unaware of that... Thanks |
BTW, as yhirano mentioned in #56 (comment), there is another opaqueness being developed for Credential Management. I was comparing the opaqueness for response (discussed in this issue) and that for analyzing possible merge/confusion/etc. in the future. I found that the opaqueness for Credential Management is kinda weak than one for response, currently (in terms of e.g. w3c/webappsec#241 (comment) and w3c/webappsec#241 (comment)). This is still subject to change if needed? E.g. making the opaqueness propagated to SW, aligning XHR/Fetch with toFormData() by requiring XHR/Fetch to comare environment's origin and FormData's origin (currently not embedded) before issuing a request. |
whatwg/fetch#49 is about adding I think @mikewest has not settled on the exact design of credential management opaqueness and is probably open to changes. |
Getting back to the MIX MSE need for opacity in some form of API, I'm not quite clear on the relative difficulties to FETCH, STREAMS, and any opaque-tainting details of doing opaqueStream vs opaqueResponse. IIUC, MSE MIX (w3c/media-source#22) needs:
I would like to find a route to enabling MIX MSE, and would appreciate your expert guidance here. |
That breaks the same-origin policy. I don't think that's acceptable. You can only have complete responses of which you expose close to nothing to the API user. |
Note: the "opaque" body I mentioned at #56 (comment) was removed. |
Regarding mixed-content , we can make a fetch for a mixed-content resource by specifying request's type to "video". Is it acceptable to create a request with a user-provided type, with some restrictions such as prohibiting cors mode? |
You'd also need to restrict how the response ends up being used. I'm not entirely convinced this is something we should be adding though. It's a fair amount of complexity for something that in a couple of years will all use HTTPS anyway. |
Even now, we can access a Response for a request with type = "video" and mode = "no-cors" in a serviceworker. So I thought we need restrictions only in the request-side. Am I missing something? |
If you could do it on a page, you could circumvent CSP restrictions. |
I see, thank you. |
This never really went anywhere. I doubt it would still be accepted as it's somewhat of a security regression in ways. Close? |
Mixed Content[1] already indicates that the following are optionally-blockable:
video loaded via
<video>
or<source>
audio loaded via
<audio>
or<source>
MSE extends the loading functionality of both
<video>
and<audio>
to let applications provide the media via buffers and streams. The typical mechanism for appending buffers to<video>
or<audio>
using MSE involves XHRs, which are "blockable" per the mixed content spec [1]. However, if opaque streams were used to provide the loaded video or audio to<video>
or<audio>
using MSE'sappendStream()
API, then MSE would not be outright "blockable" in a mixed content application scenario, extending the viability of using MSE to applications who wish to have their origin secure but are not ready yet for the content to be secure.[1] https://w3c.github.io/webappsec/specs/mixedcontent/
In particular, Fetch needs to support opaque responses by yielding an opaque stream. This bug tracks discussion and specification of this.
(Updated May 24, 2016 to show
<audio>
and<video>
correctly with markdown.)The text was updated successfully, but these errors were encountered: