-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Severing a document's opener relationship regardless of origin #10373
Comments
/cc @camillelamy |
It seems a bit unfortunate that the header starts with Also, I find |
Maybe "noopener" would be a better value. From my perspective, popups should be allowed, as long as they have their opener relationship severed. |
omit
Cross-Origin-Opener-Policy value
I think I understand what you mean, but that's a confusing comment given the current set of values. As in, To date we have only used I think the other bit that's missing here is some kind of rationale as to why we would want to invest in this capability. |
Fair, I augmented the OP a bit. Let me know if that's sufficient to understand the motivation. |
I think that justifies incoming but not outgoing. It also raises some other questions:
|
True. Thinking through this, I agree that it doesn't matter for the use case that outgoing opener relationships would be severed.
CSP frame ancestors's value of 'none' allows sensitive apps to prevent themselves from being framed by other same-origin apps. It's true that there may be cases where a frame may want to force itself to be sandboxed from the embedder. (in cases where it needs to be framed by some same-origin apps, but not directly scripted by them)
Those are presumed to be fine as communication between the different apps is permitted. (they are still the same origin) |
Changed to OP to propose the value to be |
After some prototyping, I'm now less certain that this can be achieved without an opt-in from the opener. Given that Maybe we can somehow severe it after the headers are received, but I'm not sure how that would look like without creating race conditions. |
The opener would have a reference to a closed initial about:blank. That's the same as with COOP today, no? |
A "frame" can't stand without a document. So when creating an <iframe> or a popup, they are both starting from the initial empty document. Creating the pair of frame and its initial document is always synchronous. This is only after a subsequent navigation (always asynchronous) that we start receiving headers and can decide to instantiate the next document in a different browsing context group.
From the implementation or specification point of view? |
So how should this work if a new window is first opened with page A and then later navigated to B and only B uses the new header? The Window(Proxy) A (and B?) uses may have plenty of other references than the opener relationship at that point. |
I think that would be similar to the opener relationship when page A opens a same-origin B, which then navigates to a cross-origin document. |
That's inaccurate. What I should've said is that it would be similar to the opener relationship when page A with a |
ok, and how does "noopener" in the new value hint about that behavior? Isn't the change you want a tweak to https://html.spec.whatwg.org/#matching-coop so that in some cases that same origin check wouldn't be done (and nothing to do with noopener as such)? |
That's indeed what I did in https://github.com/whatwg/html/pull/10394/files |
I think what @smaug---- is getting at is that he doesn't find |
That, and also this feels like a distinct feature of COOP itself, just like the existing noopener is a feature of its own. |
Looking at the definition: "A cross-origin opener policy value allows a document which is navigated to in a top-level browsing context to force the creation of a new top-level browsing context, and a corresponding group" That seems to be what we want here. Beyond that, we want to prevent the opener from being able to script the document in question. So to me, this very much feels related. I hesitated a bit on the Report-only mode and how it translates, but after thinking about it, it does seem like something we'd want in order to facilitate deployment here (just like for COOP). Happy to discuss this further :) |
But noopener itself is already a separate functionality in the platform. Is there a reason to not let opened page pages control opener relationship without binding that functionality to COOP. |
What additional functionality does COOP have? I thought this was it. |
We discussed about this, and I can live with this. But this needs some documentation outside the normal COOP parts so that people trying to optimize for example bfcache handling can realize there is a way to break opener relationship also from openee side. (Still feels like mixing two different features conceptually, when noopener from caller side is a separate thingie) |
Why does that documentation concern not apply to COOP generally? |
It does. But having something called Cross-Origin-Opener-Policy being possibly in a critical path on enabling bfcache even on same origin pages is a bit confusing. |
I don't think this value necessarily helps with |
Right, but you have the existing noopener for those cases. |
I guess for bfcache the initial idea of |
So two things that came up yesterday:
|
Should this be a blocker? Or something we can expand to in a separate PR?
I wonder if @arturjanc or @estark37 have opinions here as well. From my perspective, it seems prudent to start off with this not impacting the crossOriginIsolated state, and then potentially change it once we're convinced it's safe to do so. That would be a backwards compatible change AFAICT. |
I'm happy with the current proposal. Its implementation is almost the same as Regarding its interaction with COEP and process isolation, I agree that taking the most restrictive approach initially is wise (e.g. not giving any new capabilities). We can always loosen restrictions later if needed. I echo the concerns about potential developer misunderstandings regarding I'm glad to see a disclaimer has been added to the spec PR, highlighting that I read the discussion about its potential benefits for BFCache, and Yoav's question about any potential delays or blockers this might introduce. My understanding is that this proposal creates more opportunities for BFCache utilization, as no known implementations support multiple BrowsingContexts within the same BrowsingContextGroup. This seems like a clear collateral win, without any drawbacks or necessary modifications to the proposal itself. |
IIUC the proposed COOP mode is more restrictive than COOP That said, I haven't fully thought through the interactions between different COOP modes, so there's a chance that there are tricky edge cases here. As @yoavweiss mentioned above, starting without unlocking |
This is a refactor-only change, that serves as a precursor to whatwg#10394, and makes progress on whatwg#10373.
Some origins can contain different applications with different levels of security requirements. In those cases, it can be beneficial to prevent scripts running in one application from being able to open and script pages of another same-origin application. In such cases, it can be beneficial for a document to ensure its opener cannot script it, even if the opener document is a same-origin one. This adds a noopener-allow-popups Cross-Origin-Opener-Policy value that severs the opener relationship between the document loaded with this policy and its opener. At the same time, this document can open further documents (as the "allow-popups" in the name suggests) and maintain its opener relationship with them, assuming that their COOP policy allows it. Explainer: https://gist.github.com/yoavweiss/c7b61e97e6f8d207be619f87ab96ead5. Fixes whatwg#10373.
What problem are you trying to solve?
Some origins can contain different applications with different levels of security requirements. In those cases, it can be beneficial to prevent scripts running in one application from being able to open and script pages of another same-origin application.
In such cases, it can be beneficial for a document to ensure it has a null opener, even if the document that opened it is a same-origin one.
It'd be great if COOP included a value that enabled that.
What solutions exist today?
There are no solutions today to solve this AFAIK.
How would you solve it?
By adding a
no-opener-allow-popups
value to the Cross-Origin-Opener-Policy header, that results in a null opener when calling creating a new top level travesable.Anything else?
No response
The text was updated successfully, but these errors were encountered: