-
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
Folding Sec-Same-Origin into Fetch Metadata? #43
Comments
Thanks, Deian! A couple of thoughts about this, hopefully we'll get to talk about this more during the upcoming WebAppSec TPAC follow-up discussion tomorrow. Re: (2), the idea of having an opt-in mechanism that would attach the Re: (1), I was wondering what security properties you're hoping to get by knowing that the embedding happens in cross-site frame. That is, compared to a request with |
Sounds pretty reasonable.
Knowing whether or not the iframe is being embedded in a same-origin page is Here are two scenarios from our look at WordPress:
In both cases X-Frame-Options is not really a great option: it's not about Admittedly I think what I wrote about was not even strict enough: we want to |
@arturjanc if you have A embedding B and B', and B navigates B', would that be same-origin with the current processing model? I.e., information about your parent can be different from information about who navigates you. (It's not clear that only parent is enough though, it seems you would want something similar to |
Yes, it should; that's what Chrome does currently. In general, the value in
Thanks for the interesting examples, @deian! I agree there are applications which would benefit from this (at Google we have embeddable YouTube and Google Docs widgets that have different behavior when they're iframed), but there are a couple of things to consider:
So in this case I'm not entirely sure if the extra information would be as broadly useful as the other values in the Sec-Same-Origin and Fetch Metadata proposals. |
@arturjanc: The RE broadly useful/common enough: I guess I see WP as a big enough deal to get right (since like a quarter of sites on the web are WP, but maybe this statistic is changing), but I'd be curious if you have data on behavior staying the same wether or not a page is framed same-origin or not. |
The other case I'd like to make for this is almost as a compliment to |
In the second case, couldn't the server just look at I don't have solid data on when the behavior of a framed document differs depending on whether the embedder is same-origin, but, anecdotally, framebusting is the main one, and that's a legacy use case for which we now have better platform mechanisms. Basically, unlike the other values, which the application cannot get without browser support, the "is the same-origin request I'm making sent from a frame that's being embedded cross-site" bit is already something that the application can get from the platform in places where it's useful. I certainly don't mind annotating requests with more security-relevant metadata, I guess I'm just not yet sold on the value of having the browser attach this particular bit. |
Woop, you're right. I was thinking of a different case. @spinda maybe you remember? Or I'll edit this when I remember. But, actually I am not really convinced that your proposed solution to the first case via If we're going to try to keep the amount of metadata minimal it seems like that ship has sailed already (e.g., do we really need to say that something is an `image when you can have JavaScript do the checking?). |
My intuition is that it's more commonplace to execute such logic before the form is submitted because you'd want to indicate to the user that some actions are unavailable in a cross-site frame. For example, if we don't want to allow a Google Docs widget to enable certain actions when it's framed cross-site (e.g. changing sharing settings), we would remove/disable parts of the UI instead of allowing the user to execute the action and then rejecting it on the server. A declarative mechanism that avers that all ancestors of a frame which sends an HTTP request are same-origin also seems fairly constraining as it wouldn't allow e.g. trusting embedders from certain allowlisted domains, which you could do with
That's a good point, this would either need JavaScript or require the server to add something like
to forms in framed documents that should have a different behavior depending on whether their document is framed same-origin or not. I don't much about Tor Browser, but FWIW I thought they block third-party cookies, so requests from an iframe embedded cross-site wouldn't be authenticated?
I think it's more about how broadly useful the headers are for defending against cross-site attacks. My guess is that most applications would benefit from protections against CSRF, timing attacks, and more generally allowing their resources to be loaded by cross-site documents -- this is the core of both the Sec-Same-Origin and Fetch Metadata proposals. Having an embeddable widget loaded by other sites and changing its behavior based on whether the embedder is same-origin seems to be a fairly infrequent use case, and it's already possible without adding features to the platform (either by reading If we have signals from developers that the alternatives are insufficient, and that they would use this bit, I think it we should consider adding it. Otherwise, my guess is that we'll get most of the security value of these mechanisms with |
Following up on TPAC conversation. It would be great to not have multiple mechanisms for similar enough problems. The doc @spinda and I put together describing the high-level idea behind our approach is here. We will make the Firefox fork, data sets and experiments available with our academic paper write up (though we can share here/elsewhere before we finish writing up the paper).
Here are the difference I think we need from Fetch metadata to encompass Sec-Same-Origin:
The equivalent of
Sec-Frame-Same-Origin
. From our doc: With each navigation request and potential-navigation-or-subresource request, aSec-Frame-Same-Origin
header is sent to inform the server if the requested page will be contained within a cross-origin frame. Specifically, if there is no containing frame, or the URI of the page that owns the containing frame is same-origin with the request’s destination URI, then the UA will sendSec-Frame-Same-Origin: 1
; else,Sec-Frame-Same-Origin: 0
.The equivalent of the
discloseorigin
attribute andSec-Frame-Origin
header. When this attribute is set on forms and frames, we disclose the precise origin (e.g.,https://w3c.org
) with theOrigin
andSec-Frame-Origin
headers respectively (overriding Referrer Policy). If we modify the Referrer and Fetch spec to additionally apply thereferrerpolicy
attribute to frames and forms elements we won't need thedisloseorigin
attribute (I need to read the spec closer but I assume the attribute is more specific so overrides the header). We still need theSec-Frame-Origin
header though.We'll also need to make sure that our approach to computing the
SameOrigin
or not (the origin classification algorithm in the document) align.@arturjanc @lweichselbaum @spinda
The text was updated successfully, but these errors were encountered: