Description
Proposal
Add HTTP header called Cross-Origin-Window-Policy
, which takes a value of Deny
, Allow
, and Allow-PostMessage
.
When the HTTP response of a document has a Cross-Origin-Window-Policy
header, and the value case-insensitively matches Deny
ignoring cases, the document is said to be fully isolated. If the value case-insensitively matches Allow-PostMessage
ignoring cases, the document is said to be isolated with messaging. If the value doesn't match either or isn't set, then the document is said to be not isolated. If a document is fully isolated or *isolated with messaging", it is said to be isolated.
In a fully isolated document, access to any property on the window proxy of a cross-origin document (regardless of whether the target document is fully isolated or not) results in a SecurityError
. In a document isolated with messaging, access to any property except postMessage
on the window proxy of a cross-origin document results in a SecurityError
. The restriction between two documents are symmetrical and the most stricter of the two prevails.
Furthermore, a new step is inserted into the concept of allowed to navigate before step 1: If B and/or A is isolated and A and B are not of the same origin, return false.
Examples
Let document A and document B be distinct documents its own browsing contexts. If A and B are of the same origin, the header has no effect. If A and B are cross-origin, then:
-
If document B is fully isolated and document A is not isolated. Any attempt to access a property on document B's window from document A results in a
SecurityError. Any attempt to access a property on document A's window from document B also results in a
SecurityError`. -
If document B is isolated with messaging and document A is not isolated. Any attempt to access a property except
postMessage
on document B's window from document A results in aSecurityError
. Any attempt to access a property exceptpostMessage
on document A's window from document B results in aSecurityError
. -
If document B is isolated with messaging and document A is fully isolated. Any attempt to access a property on document B's window from document A results in a
SecurityError
. Any attempt to access a property on document A's window from document B results in aSecurityError
. -
If document B is isolated with messaging and document A is isolated with messaging. Any attempt to access a property except
postMessage
on document B's window from document A results in aSecurityError
. Any attempt to access a property exceptpostMessage
on document A's window from document B results in aSecurityError
.
Spectre Protection Plan
For the purpose of protecting a website a.com
from Spectre in browsers which support process swap for top-level navigations without frame-level process isolation, a.com
can set this header on all of its documents (not setting on some would result in leaks; more on this later).
If this header is set on a.com
, we can swap process on cross-origin navigation from or to a.com
's documents because this header guarantees that a.com
doesn't have access to any other document outside of its origin, and vice versa.
Let's say we're on some page B1 in b.com
, and it window.open'ed (isolated) a.com
. Then b.com
doesn't have access to a.com
, and b.com
doesn't have access to a.com
so we can put them into two different processes. Obviously, a.com
's iframes don't have access to b.com
's frame tree either so if a website is currently relying on being able to do this, they won't be able to use this header.
Let's say now a.com
is navigated to some other page B2 in b.com
. In this case, the browser finds the process which loaded B1 and load B2 in the same process so that they can talk to one another via window proxies.