Skip to content
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

Coop noopener allow popups #36232

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ If a cross-origin document with COOP is opened in a new window, the opening docu
Cross-Origin-Opener-Policy: unsafe-none
Cross-Origin-Opener-Policy: same-origin-allow-popups
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Opener-Policy: noopener-allow-popups
```

### Directives
Expand All @@ -42,6 +43,9 @@ Cross-Origin-Opener-Policy: same-origin
- : Retains references to newly opened windows or tabs that either don't set COOP or that opt out of isolation by setting a COOP of `unsafe-none`.
yoavweiss marked this conversation as resolved.
Show resolved Hide resolved
- `same-origin`
- : Isolates the browsing context exclusively to same-origin documents. Cross-origin documents are not loaded in the same browsing context.
- `noopener-allow-popups`
- : Severs the opener connection to the new document, isolating the browsing context for the current document regardless of the opener document's origin.
This ensures that the opener can't run scripts in the opened documents even if they are same origin.
yoavweiss marked this conversation as resolved.
Show resolved Hide resolved

## Examples

Expand Down Expand Up @@ -70,6 +74,31 @@ if (crossOriginIsolated) {
}
```

### Severing the opener relationship

The `Cross-Origin-Opener-Policy: noopener-allow-popups` header can be used to ensure that the document that opened a document with these headers cannot directly script it.

To understand where this can be useful, let's examine a hypothetical example.com origin that has two very different applications.
One is https://example.com/chat that enables any user to contact any other user and send them messages.
Another is https://example.com/passwords that contains all of the user's passwords, across different services.

Common security advice to further isolate these applications would be to host them on different origins.
But in some cases that's not possible, and those two applications have to be on a single origin for historical/business/branding reasons.

At the same time, the administrators of the "passwords" application would very much like to ensure that it can't be directly scripted by the "chat" app, which by its nature has a larger XSS surface.

`Cross-Origin-Opener-Policy: noopener-allow-popups` helps them do that.

At the same time, by itself it is not a sufficient security measure.
They would also need to do the following:

- Use Fetch Metadata to block same-origin requests to the more-sensitive app that are not navigation requests.
- Ensure their authentication cookies are all `HttpOnly`.
- Ensure root-level Service-Workers are not installed by the less-sensitive app.
- Ensure that `postMessage` or `BroadcastMessage` on the more-sensitive app don't expose any sensitive information the any other same-origin app.
- Ensure their login page is served on a separate origin, due to password manager autofill being applied based on origin.
- Understand that the browser may still allocate the more-sensitive app in the same process as the less-sensitive one, making it vulnerable to Spectre-like attacks.

## Specifications

{{Specifications}}
Expand Down