-
Notifications
You must be signed in to change notification settings - Fork 28
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
Is Sec-Fetch-Dest
necessary?
#16
Comments
Do you have specific concerns about exposing the Also, A fairly significant benefit of exposing the destination is to allow the server to prevent attacks based on loading resources in an unexpected context: for example, GitHub folks liked the idea of rejecting any requests with |
@arturjanc's thoughts (unsurprisingly!) match my own. That said, I'd be fine moving the |
There's quite a few destinations that make sense for images. And even if you block ( |
I looked at the data for requests to our applications from clients with the Chrome flag enabled, and I see that 99.87% requests which return an The handful of remaining cases include direct navigations to images (also visible via More generally, I'd posit that in benign scenarios the server must already have enough information in the request to return the appropriate type of resource for the context -- this information is usually implicit in the URL. I'm having some trouble seeing how making the
The concern is about attacks similar to Rosetta Flash where a resource with a benign Such responses would not be treated as plugin resources when navigated to directly, but would be recognized as plugins (and given same-origin access to the hosting origin) when the attacker's site loads them via Note that this is just one example. There have been other attacks based on intentional Content-Type mismatches, e.g. exfiltrating data from HTML by loading it as CSS; it seems useful for a server to make sure that its responses won't be used in a wrong context, especially for cross-origin requests. |
If you can already determine it, there's even less reason to add it to the request. Note that you'd also need to block This is the same as with loading HTML as CSS. |
You can determine it for legitimate traffic -- if my application loads a resource as an You cannot determine it for malicious traffic where a resource is loaded as a mismatched type on purpose by the attacker. For Similarly, it's valuable for a server to globally lock down the application and allow only cross-origin requests for a subset of resource types that the application wants to expose externally. If I expect stylesheets to be the only type of resource in my application that can be loaded cross-origin, I can create an a priori allowlist that will ensure my responses can't be used in any other context -- this is particularly useful as a server-side complement to CORB/CORP. Taking a step back, it would be very helpful if you could elaborate on your specific concerns about |
Concerns I have:
|
Thanks for the list, @annevk!
This is certainly a concern, sending more information will necessarily increase the size of requests. In the TAG review @mikewest mentioned possible approaches to reduce the size, but they are somewhat at odds with readability and ease of adoption in that they require server-side parsing code, which developers prefer to avoid. IMHO sending
It's likely that many servers won't use this information so it may be more than what's needed for them; this is arguably similar to I tried to identify scenarios where
I also feel strongly about avoiding exposing sensitive new information, but if we're considering reducing the capabilities of a fairly critical security mechanism ( |
Let's split this into two issues: Should the nestedness (or poppedupness, as per #17) of a given navigation be represented in the I don't have a strong opinion here, as either field seems to be equally deployable and would give servers the information they need to make reasonable decisions. I'll defer to you, @annevk. If you'd prefer to represent these navigations in Fetch/HTML as a If we move nestedness elsewhere, is I don't think I agree with the implied claim above that the information in This leaves more than a few types out there that are useful to distinguish. For example:
I suspect folks like @arturjanc will discover more combinations of fetch characteristics that can be distinguished and mitigated as they experiment more with the feature on actual applications in the wild. That is to say, I see the "content negotiation strategy" bits of this as a feature, not a bug, especially insofar as the negotiation is binary in nature (e.g. Perhaps you could elaborate on the risks you see there? |
The server cannot reliably tell the destination from this header due to service workers. It isn't bound to the response in some manner so therefore can be wrong. It'll be hard to describe specific mitigations that apply generally. If the plugin thing is a real problem, let's make I also don't think my general argument is (or has been) that the information is available otherwise. It's that it's not clear to me this needs to be exposed and provides the correct security guarantees a server might be looking for. |
Service workers can't set Or, do you mean that the service worker can launder any header type into |
Right, that they can create their own request using |
That's exciting. @arturjanc, WDYT?
It's a problem folks at GitHub (like @ptoomey3) have asked about specifically. I can imagine XCTO helping (though now I'm wondering what our existing model is for plugin content and laundering through service workers). |
To better understand the Service Worker issue: does it allow spoofing any If it's the former, then I agree that it would largely undermine the security value of providing destination because the server couldn't rely on it to make security decisions. However, if it's the latter, then the server would just need to take into account that As another example, consider the Spectre prevention role of |
A service worker can feed |
I'm 99% sure my above comment is incorrect. Unless a request fully bypasses a service worker (i.e., the service worker does not touch it or store it) there's no way it should be allowed to preserve |
With That means the server can trust that the The service worker could use the response as a response to a different request, so I don't know if that's enough. Is there an example of an attack that |
I think #22 covers that work. |
👀 I'm using It seems there is no other convenient way to distinguish what a browser want by other information than this header so this header is necessary for me. |
While perhaps somewhat of a niche use case - since we don't have media-types for |
Thanks for the feedback, folks. After more discussion than expected, I think we've generally come to the conclusion that |
Did you consider splitting the mode rather than the destination? Perhaps that would allow for not exposing the destination at all, decreasing the amount of information we share?
The text was updated successfully, but these errors were encountered: