-
Notifications
You must be signed in to change notification settings - Fork 333
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
Safelist Last-Event-ID #568
Comments
Chrome definitely leaks |
Confirmed that Firefox and Safari do it though using Charles Proxy. We should just safelist the header. |
It turns out that you can set the Last-Event-ID request header to arbitrary values and get it across origins. That seems like sufficient reason to safelist it and hopefully make it clear to server administrators to pay extra attention to this header. Tests: ... Fixes #568.
@whatwg/security thoughts? |
@johnwilander @horo-t I'm no longer convinced that safelisting this is correct as it would allow for the kind of values that might result in script execution on the server and they could potentially bypass the length checks we now have in place. Do you have thoughts on how to fix this? |
Sorry, I'm not familiar with EventSource. @yutakahirano knows more than me. |
@johnwilander @yutakahirano ping. |
Can you elaborate on this a bit more? |
@yutakahirano create a same-origin server-sent events endpoint. Generate a very large ID and then end the stream. Upon seeing the very large ID, redirect to the victim server. |
If we safelist |
The other problem is that it can contain essentially any header value byte, which historically has been an attack vector (and is why we have restrictions on the other headers now). We'd have to apply the same restrictions as with |
Sounds good. Then what we need to do is to check how many site would be broken by such a change, right? |
Yeah. |
FWIW I think I can help such an investigation. I'm not sure I'll have enough time to ship the change in the near future because we'll need to talk with enterprise people to actually ship this kind of change. |
@yoichio is working on this. |
Hi, I got a statistics. So I'd say the change looks safe in terms of compatibility risk. |
That is great news! Here is what we need to do specification-wise:
I suspect that all implementers are on board aligning here given that it currently represents a hole in our same-origin policy protections. |
Is there any movement on this, or ways that I as a non-browser developer can help move this along? Some environments do not have a native EventSource implementation, and polyfilling these with a fetch implementation currently triggers CORS preflights when a last event ID is sent, which not all servers have safelisted. |
None of the outlined steps involve browser engineering. It involves making a change to the standard defined in this repository and corresponding test changes in https://github.com/web-platform-tests/wpt. This is some work, but it should be relatively straightforward. If you get stuck somewhere feel free to reach out on https://whatwg.org/chat. |
Since EventSource implementations in most environments already send this header without CORS preflight request, it makes sense to make it a safelisted header. Fixes whatwg#568
The EventSource API does _not_ run any preflight request when specifying the `Last-Event-ID` header, and so `fetch` requests should also allow this header to be set manually. See whatwg/fetch#568 for more information
Since EventSource implementations in most environments already send this header without CORS preflight request, it makes sense to make it a safelisted header. See whatwg#568
In whatwg/html#689 the discussion seemed to land on allowing UTF-8 bytes except for 0x00, 0x0A, and 0x0D. This issue is about safelisting the header for cross-origin requests, but applying restrictions to it beyond what was discussed in whatwg/html#689. In essence, a "safe"
Questions:
|
Add @ricea, or current network owner. |
|
The EventSource API does _not_ run any preflight request when specifying the `Last-Event-ID` header, and so `fetch` requests should also allow this header to be set manually. See whatwg/fetch#568 for more information
Thanks for the clarification! Have updated WPT tests to match. |
Per whatwg/html#689 it can contain any header value. And it seems that a page with a cooperating server can send that header anywhere due to redirects.
Basically, use
EventSource
to open a connection. Get the server to set the ID. Then trigger a reconnection. Then when the server gets the header, redirect that request to wherever. That request to wherever will include theLast-Event-ID
header with a value that can be controlled by the server that did the redirect.Given that this has been the case for forever, we might as well enshrine it. (Should probably write a test to confirm though.)
The text was updated successfully, but these errors were encountered: