-
Notifications
You must be signed in to change notification settings - Fork 164
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
Possible feature discussion: opaque streams #983
Comments
In the case of const response = await fetch(url, {mode: 'no-cors'});
postMessage(response, origin, [response]); But then what would be the benefit of initiating a
What can you do with an opaque stream, other than transferring it? Can you pipe an opaque readable stream into an writable stream? I guess that would require the writable stream to either be or become opaque as well. For example:
Could you observe the result of an pipe between opaque streams? Is the initiator of the pipe allowed to know whether the pipe completes successfully or with an error through the pipe's |
Yes, probably. 😄
I feel that there's something here, but I don't know what it is yet. @yutakahirano pointed out that we'd quite like to do away with opaque responses and
Yes.
I hadn't thought of that. I think the creator of the TransformStream would still have to opt-in to this behaviour, so they couldn't be tricked into leaking information through a side-channel.
The internals of pipes are hidden from user JavaScript to make them more optimisable, but this also makes them a theoretically safe way to manipulate opaque streams.
I'm not sure. Certainly we'd have to replace the rejection reason with something harmless. But even the fact that it failed may be too sensitive to expose.
A difficult question. It requires a detailed threat model, which I don't think we can create until we have some concrete use cases. |
I think if the readable side of the transform stream also becomes opaque, it should be safe. Not an expert though. 😛
Even the promise resolving tells the initiator that the readable stream became closed. I think that might be used to estimate the "size" of the readable stream?
Agreed. For the moment, I don't see many benefits, and a lot of potential security issues. I think this would be better solved by making |
Opaque streams are something we might wish to add in future. An opaque stream is a stream you can't read from, but you can pass it off to APIs that can.
With opaque streams, instead of
response.body
returningnull
for an opaque response, it would return an opaque stream.Currently:
But with opaque streams:
So far we haven't gained anything, but we can now pass our stream off to someone who can use it, eg.
If
origin
has access tourl
, they can get a reader onbody
and read from it as usual.The goal is that any platform API that produces or consumes opaque data will be composable via streams.
An opaque stream can also be thought of as a stream with an ACL attached to it.
The exact mechanism by which some contexts and APIs are authorised to read/write/transform opaque streams is TBD, along with the security threat model.
The text was updated successfully, but these errors were encountered: