-
Notifications
You must be signed in to change notification settings - Fork 341
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
Proposal: Sec-Site
should capture information about the requester of a resource
#700
Comments
Making it compatible with Referrer Policy could work, but I think that would disadvantage UAs who want a non-default policy there. E.g., if in the future they decide they should reveal less, it's highly likely they'd break sites that come to rely on this header returning a certain value. |
That's a good point; though I think this would only happen if a UA adopted a default RP of The way to tackle it probably depends on whether we think it would be the responsibility of the UA or site authors to prevent applications using
I don't really like the explicit security vs. privacy tradeoff of the second option, but depending on how we see the Referrer-disabling mode being used, maybe it could be worth considering. |
I think this is a good direction to explore, allowing a developer to make granular decisions about ACLs for particular resources/requests based on its initiator. I think I agree with the advantages @arturjanc posits, and I also agree with his analysis of the Referrer Policy integration. I'd go further than @arturjanc, actually, and suggest that Before diving too deeply into details (and I'd add redirect behavior to the list of @arturjanc's questions), I'd be curious about the rest of @whatwg/security's opinion on the proposal more generally. It seems pretty reasonable to me, and worth the time to sketch out. |
@mikewest I think it would only mitigate the risk if those were the only values transmitted. |
Well, let's start with that as a baseline: could we agree that sending the three-value enum would be fine? I believe there's some real value in more granularity above and beyond that enum for services that wish to expose data to some subset of cross-origin entities, but not all cross-origin entities (for example: Perhaps we could send both? That is, we might send (As an aside: is this a practical concern, or a theoretical concern? That is, is Mozilla pondering killing |
Theoretical at this point, but it seems good to allow for it. Exposing both bits (perhaps space-separated to make it different from multiple headers) seems like an interesting approach. That at least doesn't result in unexpected values on the server side. A cross-origin redirect or sandbox would make the second bit |
Including both values (separated by whatever characters you like!) seems valuable, independent of the referrer policy concerns, as |
I thought we agreed that same-site would mean same eTLD+1 for these purposes. Not true? I pointed this out regarding SameSite cookies in #687 (comment) but then the thread seemed to go on to say that same-site should be same eTLD+1. |
It looks like Origin Policy is stateful cross-site. True? From the spec: If so, it won't fly for us for anti tracking reasons. Maybe partitioning would make sense. Were there any thoughts on that? |
@johnwilander same-site does mean eTLD+1, but cross-origin != cross-site. What @mikewest was trying to demonstrate is that sometimes having the actual origin is useful to make decisions, even if it's same-site or cross-site. As for Origin Policy, I think folks had thoughts on removing the statefullness somehow, but no progress has been made recently. The draft as it stands today is known not to work for Safari. |
Ah, got it. I misread his comment. He does imply that same-site is eTLD+1.
OK. Thx. |
It's not hugely important, but if we can make it work without gating on Origin Policy I would also prefer that. I mentioned this possibility because an origin-level opt-in would address past concerns about request size (#687 (comment)), but it would be easier for developers if we could send this information by default. |
Is there any room in this proposal for including the type of request (corresponding to the "AS script" etc in other specs). If you've got a document URL with params and it's being requested as an IMG then it's probably an attack of some kind. |
Yes, this would certainly be useful -- @mikewest also mentioned this and I attempted to capture something similar as one of the open questions above. I imagine that developers could refactor application code which sets the Content-Type of responses to inspect the request type and make sure they match (possibly starting by logging unexpected values to detect accidental mismatches). |
I know I've talked to @arturjanc about this, and I do support it. I don't think I've written that down anywhere, though, so, there you are. :) Encoding the initiator and destination of the request in a way the server can access would be really interesting, and I can see real use cases for it from a security perspective. I think origin manifests are a bit off topic, but:
I don't think there's any tweaking around the edges that we can do to make origin manifests not represent state in third-party contexts. Regardless of explicit advertisement of the manifest version in HTTP request headers, the mechanism will certainly support some features that will create web-visible state for a given origin: that's the whole point of the feature. :) As a silly example, consider a manifest that sets a
I don't see this as at all related to origin manifests, except insofar as origin manifests might be a reasonable configuration mechanism if we decide that this should be opt-in. I'm not sure the size overhead is enough to care about, but it's a debate worth having. |
One valid question that came up recently in a related discussion is why developers cannot use the The main reason for this is that developers cannot count on the (Some applications could certainly do without the origin at all, and reject all |
Yesterday at WebAppSec we had a chance to briefly talk about the aspect of this proposal which would expose the actual origin of the sender of a resource request, as opposed to a more coarse-grained value ( The main concern is that we'd be building a "new Referrer" which would reveal the originator of the request, but in a new place. Given that the (Narrowly, on the last point about possible site breakage: I think we could handle this case by making sure to remove the entire When it comes to the general worry about disclosing the requester's origin in The main reason I think so is that for cross-origin requests in So, from the application developer's point of view, If, despite the things mentioned above, exposing the requesting origin in
The reason I'm pushing on this aspect (sorry for being a pest!) is that having reliable origin information in resource requests, particularly by default, would make it much easier to deploy protections from cross-origin leaks in any application that isn't fully self-contained in a single origin, or has endpoints that may legitimately be requested cross-origin. The application could first gather origin information from existing requests, build a whitelist of origins which currently load data from it, and then lock down processing of sensitive responses to requests from the whitelisted origins. If a significant number of requests only carried the |
Just one note: subframe loads do not have a "cors" mode right now, and are conceptually a lot more like navigations (I mean, they are navigations) than like subresource requests in a lot of ways. Though they are subresource requests in other ways... In any case, this part would need some thinking about. |
After talking with @arturjanc and a few other folks at Google, I've tried to condense this discussion down into a short explainer that punts on the origin question (we'll do some research on the side and come back to it), and adds @dveditz's |
Let's fold this into #885. |
This is a follow-up to #687, specifically: #687 (comment)
Background
To protect against cross-origin information leaks, exploitable by embedding a victim application's resources in an attacker-controlled document and inferring information about their contents, it would be useful to have a universal way to provide the application with information about the sender of the request with a request header. This would enable server-side decisions about whether to respond with sensitive resources depending on the context in which they are embedded, and could provide a robust way to protect against attacks such as CSRF, XS-Search, cross-origin timings and Spectre-like bugs.
This is conceptually similar to the
Origin
header, but would need to be present on all resource requests (possibly only to origins which opt in) -- otherwise an attacker could embed the resource in a way which doesn't cause the header to be sent, without giving the server the opportunity to reject the request. Servers which want to add protection against cross-origin information leaks would inspect the value of theSec-Site
header and could reject requests from origins they do not trust.Details
From an adopter's point of view, the most useful variant would be identifying the source of the request with its origin, e.g.
In #687 (comment) @annevk mentioned some sensible concerns about sending the full origin value that I hope he can elaborate on here :) I expect that we can (and should!) make this feature fully compatible with the Referrer Policy by doing the following:
Referer
header that contains the origin, send the exact origin value.same-origin
,same-site
orcross-site
(spelling TBD).This way most developers could write code such as:
In applications which don't have a Referrer Policy of
no-referrer
this would be even simpler because the developer could just rely on a URL whitelist.I'd be a little wary of going with just the coarse-grained values because many applications have resources which are legitimately requested cross-origin, which wouldn't allow the developer to protect them. WDYT @annevk, would that be reasonable?
Questions
This is obviously just a sketch of the idea; if we want to pursue it more, we should probably think about the following issues:
Origin
instead (FWIW my guess is that would be ugly.)@mikewest certainly has some thoughts about this as well.
The text was updated successfully, but these errors were encountered: