Skip to content

Commit cbcf6ac

Browse files
Make COOP+COEP not imply cross-origin isolated
This contains 3 changes: --- The specification currently requires COOP+COEP to give access to cross-origin isolated capabilities like SharedArrayBuffer. Some platforms can't easily support multiple processes (like Android Webview). Therefore, they can't really support cross-origin isolated. However the are no strong reasons for them not to enforce COEP and COEP when their associated headers are present. This patch changes the specification to allow (instead of requiring) platforms to grant the cross-origin isolated capability when both COOP and COEP are used. The browsing context group's cross-origin-isolation mode becomes a tri-state: - none (not COOP+COEP) - logical (COOP+COEP, without granting cross-origin isolated) - concrete (COOP+COEP, with granting cross-origin isolated) Closes #6060. --- When setting document.domain, both properties were previously checked: 1. agent-cluster's cross-origin-isolation mode. 2. agent-cluster's origin-keyed. The first has been removed, since it already implies the second. --- When serializing a SharedArrayBuffer, check the cross-origin isolated capability instead of the cross-origin isolation mode. This was an oversight from when the cross-origin isolated capability was first introduced.
1 parent 2928953 commit cbcf6ac

File tree

1 file changed

+101
-42
lines changed

1 file changed

+101
-42
lines changed

source

Lines changed: 101 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -8085,16 +8085,16 @@ interface <dfn>DOMStringList</dfn> {
80858085
<p>If ! <span>IsSharedArrayBuffer</span>(<var>value</var>) is true, then:
80868086

80878087
<ol>
8088-
<li><p>Let <var>agentCluster</var> be the <span>surrounding agent</span>'s
8089-
<span>agent cluster</span>.</p></li>
8090-
80918088
<li>
8092-
<p>If <var>agentCluster</var>'s <span>cross-origin isolated</span> is false, then throw a
8093-
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p>
8089+
<p>If the <span>current settings object</span>'s <span
8090+
data-x="concept-settings-object-cross-origin-isolated-capability">cross-origin isolated
8091+
capability</span> is false, then throw a <span>"<code>DataCloneError</code>"</span>
8092+
<code>DOMException</code>.</p>
80948093

80958094
<p class="note">This check is only needed when serializing (and not when deserializing) as
8096-
<span>cross-origin isolated</span> cannot change over time and a
8097-
<code>SharedArrayBuffer</code> cannot leave an <span>agent cluster</span>.</p>
8095+
the <span data-x="concept-settings-object-cross-origin-isolated-capability">cross-origin
8096+
isolated capability</span> cannot change over time and a <code>SharedArrayBuffer</code>
8097+
cannot leave an <span>agent cluster</span>.</p>
80988098
</li>
80998099

81008100
<li><p>If <var>forStorage</var> is true, then throw a
@@ -77984,9 +77984,6 @@ console.assert(iframeWindow.frameElement === null);
7798477984
keys</span> to <span data-x="agent cluster">agent clusters</span>). User agents are responsible
7798577985
for collecting agent clusters when it is deemed that nothing can access them anymore.</p>
7798677986

77987-
<p>A <span>browsing context group</span> has a <dfn data-x="bcg cross-origin
77988-
isolated">cross-origin isolated</dfn> boolean. It is initially false.</p>
77989-
7799077987
<p>A <span>browsing context group</span> has an associated <dfn>historical agent cluster key
7799177988
map</dfn>, which is a <span data-x="ordered map">map</span> of <span
7799277989
data-x="origin">origins</span> to <span data-x="agent cluster key">agent cluster keys</span>. This
@@ -77997,6 +77994,41 @@ console.assert(iframeWindow.frameElement === null);
7799777994
<p class="note">The <span>historical agent cluster key map</span> only ever gains entries over the
7799877995
lifetime of the browsing context group.</p>
7799977996

77997+
<p>A <span>browsing context group</span> has a <dfn
77998+
data-x="bcg-cross-origin-isolation">cross-origin isolation mode</dfn>, which is a
77999+
<span>cross-origin isolation mode</span>. It is initially "<code
78000+
data-x="cross-origin-isolation-none">none</code>".</p>
78001+
78002+
<p>A <dfn>cross-origin isolation mode</dfn> is one of three possible values: "<dfn><code
78003+
data-x="cross-origin-isolation-none">none</code></dfn>", "<dfn><code
78004+
data-x="cross-origin-isolation-logical">logical</code></dfn>", or "<dfn><code
78005+
data-x="cross-origin-isolation-concrete">concrete</code></dfn>".</p>
78006+
78007+
<div class="note">
78008+
<p>"<code data-x="cross-origin-isolation-logical">logical</code>" and "<code
78009+
data-x="cross-origin-isolation-concrete">concrete</code>" are similar. They are both used for
78010+
<span data-x="browsing context group">browsing context groups</span> where:</p>
78011+
78012+
<ul>
78013+
<li><p>every top-level <span>Document</span> has `<code data-x=""><span
78014+
data-x="http-cross-origin-opener-policy">Cross-Origin-Opener-Policy</span>: <span
78015+
data-x="coop-same-origin">same-origin</span></code>`, and</p></li>
78016+
78017+
<li><p>every <span>Document</span> has `<code
78018+
data-x=""><span>Cross-Origin-Embedder-Policy</span>: <span
78019+
data-x="coep-require-corp">require-corp</span></code>`.</p></li>
78020+
</ul>
78021+
78022+
<p>On some platforms, it is difficult to provide the security properties required to grant safe
78023+
access to the APIs gated by the <span
78024+
data-x="concept-settings-object-cross-origin-isolated-capability">cross-origin isolated
78025+
capability</span>. As a result, only "<code
78026+
data-x="cross-origin-isolation-concrete">concrete</code>" can grant access that capability.
78027+
"<code data-x="cross-origin-isolation-logical">logical</code>" is used on platform not supporting
78028+
this capability, where various restrictions imposed by cross-origin isolation will still apply,
78029+
but the capability is not granted.</p>
78030+
</div>
78031+
7800078032
<p>To <dfn data-x="creating a new browsing context group">create a new browsing context
7800178033
group</dfn>, run these steps:</p>
7800278034

@@ -79645,11 +79677,18 @@ interface <dfn>BarProp</dfn> {
7964579677

7964679678
<dt>The <span data-x="concept-settings-object-cross-origin-isolated-capability">cross-origin
7964779679
isolated capability</span></dt>
79648-
<dd><p>Return the logical conjunction of <var>realm</var>'s <span>agent cluster</span>'s
79649-
<span>cross-origin isolated</span> and whether <var>window</var>'s <span
79650-
data-x="concept-document-window">associated <code>Document</code></span> is <span>allowed to
79651-
use</span> the "<code data-x="cross-origin-isolated-feature">cross-origin-isolated</code>"
79652-
feature.</p></dd>
79680+
<dd>
79681+
<p>Return true if both of the following hold, and false otherwise:</p>
79682+
<ol>
79683+
<li><p><var>realm</var>'s <span>agent cluster</span>'s <span
79684+
data-x="agent-cluster-cross-origin-isolation">cross-origin-isolation mode</span> is "<code
79685+
data-x="cross-origin-isolation-concrete">concrete</code>", and</p></li>
79686+
79687+
<li><p><var>window</var>'s <span data-x="concept-document-window">associated
79688+
<code>Document</code></span> is <span>allowed to use</span> the "<code
79689+
data-x="cross-origin-isolated-feature">cross-origin-isolated</code>" feature.</p></li>
79690+
</ol>
79691+
</dd>
7965379692
</dl>
7965479693
</li>
7965579694

@@ -80424,9 +80463,6 @@ interface <dfn>BarProp</dfn> {
8042480463
a registrable domain suffix of and is not equal to</span> <var>effectiveDomain</var>, then throw
8042580464
a <span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p></li>
8042680465

80427-
<li><p>If the <span>surrounding agent</span>'s <span>agent cluster</span>'s <span>cross-origin
80428-
isolated</span> is true, then return.</p></li>
80429-
8043080466
<li><p>If the <span>surrounding agent</span>'s <span>agent cluster</span>'s <span>is
8043180467
origin-keyed</span> is true, then return.</p></li>
8043280468

@@ -80534,10 +80570,11 @@ interface <dfn>BarProp</dfn> {
8053480570
and the <code data-x="dom-originAgentCluster">originAgentCluster</code> getter will always return
8053580571
true.</p>
8053680572

80537-
<p class="note">Similarly, <code>Document</code>s in a <span>cross-origin isolated</span>
80538-
<span>agent cluster</span> are automatically origin-keyed. The `<code
80539-
data-x="http-origin-agent-cluster">Origin-Agent-Cluster</code>` header might be useful as an
80540-
additional hint to implementations about resource allocation, since the `<code
80573+
<p class="note">Similarly, <code>Document</code>s whose <span>agent cluster</span>'s
80574+
<span data-x="agent-cluster-cross-origin-isolation">cross-origin isolation mode</span> is not
80575+
"<code data-x="cross-origin-isolation-none">none</code>" are automatically origin-keyed. The
80576+
`<code data-x="http-origin-agent-cluster">Origin-Agent-Cluster</code>` header might be useful as
80577+
an additional hint to implementations about resource allocation, since the `<code
8054180578
data-x="http-cross-origin-opener-policy">Cross-Origin-Opener-Policy</code>` and
8054280579
`<code>Cross-Origin-Embedder-Policy</code>` headers used to achieve cross-origin isolation are
8054380580
more about ensuring that everything in the same address space opts in to being there. But adding
@@ -80901,8 +80938,9 @@ interface <dfn>BarProp</dfn> {
8090180938
<dd>
8090280939
<p>This behaves the same as "<code data-x="coop-same-origin">same-origin</code>", with the
8090380940
addition that it sets the (new) <span>top-level browsing context</span>'s <span data-x="tlbc
80904-
group">group</span>'s <span data-x="bcg cross-origin isolated">cross-origin isolated</span> to
80905-
true.</p>
80941+
group">group</span>'s <span data-x="bcg-cross-origin-isolation">cross-origin isolation
80942+
mode</span> to one of "<code data-x="cross-origin-isolation-logical">logical</code>" or "<code
80943+
data-x="cross-origin-isolation-concrete">concrete</code>".</p>
8090680944

8090780945
<p class="note">"<code data-x="coop-same-origin-plus-COEP">same-origin-plus-COEP</code>" cannot
8090880946
be directly set via the `<code
@@ -81308,10 +81346,21 @@ interface <dfn>BarProp</dfn> {
8130881346
<li><p>Let <var>newBrowsingContext</var> be the result of <span>creating a new top-level browsing
8130981347
context</span>.</p></li>
8131081348

81311-
<li><p>If <var>navigationCOOP</var>'s <span data-x="coop-struct-value">value</span> is "<code
81312-
data-x="coop-same-origin-plus-COEP">same-origin-plus-COEP</code>", then set
81313-
<var>newBrowsingContext</var>'s <span data-x="tlbc group">group</span>'s <span data-x="bcg
81314-
cross-origin isolated">cross-origin isolated</span> to true.</p></li>
81349+
<li>
81350+
<p>If <var>navigationCOOP</var>'s <span data-x="coop-struct-value">value</span> is "<code
81351+
data-x="coop-same-origin-plus-COEP">same-origin-plus-COEP</code>", then set
81352+
<var>newBrowsingContext</var>'s <span data-x="tlbc group">group</span>'s <span
81353+
data-x="bcg-cross-origin-isolation">cross-origin isolation mode</span> to either "<code
81354+
data-x="cross-origin-isolation-logical">logical</code>" or "<code
81355+
data-x="cross-origin-isolation-concrete">concrete</code>". The choice of which is
81356+
<span>implementation-defined</span>.</p>
81357+
81358+
<p class="note">It is difficult on some platforms to provide the security properties required by
81359+
the <span data-x="concept-settings-object-cross-origin-isolated-capability">cross-origin
81360+
isolated capability</span>. "<code data-x="cross-origin-isolation-concrete">concrete</code>"
81361+
grants access to it and "<code data-x="cross-origin-isolation-logical">logical</code>" does
81362+
not.</p>
81363+
</li>
8131581364

8131681365
<li>
8131781366
<p>If <var>sandboxFlags</var> is not empty, then:</p>
@@ -86778,8 +86827,8 @@ interface <dfn>BeforeUnloadEvent</dfn> : <span>Event</span> {
8677886827
<p>Contains various <code>Window</code> objects which can potentially reach each other, either
8677986828
directly or by using <code data-x="dom-document-domain">document.domain</code>.</p>
8678086829

86781-
<p>If the encompassing <span>agent cluster</span>'s <span>cross-origin isolated</span> is true,
86782-
then all the <code>Window</code> objects will be <span>same origin</span>, can reach each other
86830+
<p>If the encompassing <span>agent cluster</span>'s <span>is origin-keyed</span> is true, then
86831+
all the <code>Window</code> objects will be <span>same origin</span>, can reach each other
8678386832
directly, and <code data-x="dom-document-domain">document.domain</code> will no-op.</p>
8678486833

8678586834
<p class="note">Two <code>Window</code> objects that are <span>same origin</span> can be in
@@ -86862,8 +86911,10 @@ interface <dfn>BeforeUnloadEvent</dfn> : <span>Event</span> {
8686286911

8686386912
<div w-nodev>
8686486913

86865-
<p>An <span>agent cluster</span> has an associated <dfn>cross-origin isolated</dfn> (a boolean),
86866-
which is initially false.</p>
86914+
<p>An <span>agent cluster</span> has an associated <dfn
86915+
data-x="agent-cluster-cross-origin-isolation">cross-origin isolation mode</dfn>, which is a
86916+
<span>cross-origin isolation mode</span>. It is initially "<code
86917+
data-x="cross-origin-isolation-none">none</code>".</p>
8686786918

8686886919
<p>An <span>agent cluster</span> has an associated <dfn>is origin-keyed</dfn> (a boolean), which
8686986920
is initially false.</p>
@@ -86891,8 +86942,9 @@ interface <dfn>BeforeUnloadEvent</dfn> : <span>Event</span> {
8689186942

8689286943
<li><p>Let <var>key</var> be <var>site</var>.</p></li>
8689386944

86894-
<li><p>If <var>group</var>'s <span data-x="bcg cross-origin isolated">cross-origin
86895-
isolated</span> is true, then set <var>key</var> to <var>origin</var>.</p></li>
86945+
<li><p>If <var>group</var>'s <span data-x="bcg-cross-origin-isolation">cross-origin isolation
86946+
mode</span> is not "<code data-x="cross-origin-isolation-none">none</code>", then set
86947+
<var>key</var> to <var>origin</var>.</p></li>
8689686948

8689786949
<li><p>Otherwise, if <var>group</var>'s <span>historical agent cluster key
8689886950
map</span>[<var>origin</var>] <span data-x="map exists">exists</span>, then set <var>key</var> to
@@ -86917,8 +86969,10 @@ interface <dfn>BeforeUnloadEvent</dfn> : <span>Event</span> {
8691786969
<ol>
8691886970
<li><p>Let <var>agentCluster</var> be a new <span>agent cluster</span>.</p></li>
8691986971

86920-
<li><p>Set <var>agentCluster</var>'s <span>cross-origin isolated</span> to <var>group</var>'s
86921-
<span data-x="bcg cross-origin isolated">cross-origin isolated</span>.</p></li>
86972+
<li><p>Set <var>agentCluster</var>'s <span
86973+
data-x="agent-cluster-cross-origin-isolation">cross-origin isolation mode</span> to
86974+
<var>group</var>'s <span data-x="bcg-cross-origin-isolation">cross-origin isolation
86975+
mode</span>.</p></li>
8692286976

8692386977
<li><p>Set <var>agentCluster</var>'s <span>is origin-keyed</span> to true if <var>key</var>
8692486978
equals <var>origin</var>; otherwise false.</p></li>
@@ -87299,8 +87353,9 @@ interface <dfn>BeforeUnloadEvent</dfn> : <span>Event</span> {
8729987353
href="https://github.com/tc39/ecma262/issues/1357">tc39/ecma262#1357</a>.</span></p></li>
8730087354

8730187355
<li>
87302-
<p>If <var>agent</var>'s <span>agent cluster</span>'s <span>cross-origin isolated</span> is
87303-
false, then:</p>
87356+
<p>If <var>agent</var>'s <span>agent cluster</span>'s <span
87357+
data-x="agent-cluster-cross-origin-isolation">cross-origin isolation mode</span> is "<code
87358+
data-x="cross-origin-isolation-none">none</code>", then:</p>
8730487359

8730587360
<ol>
8730687361
<li><p>Let <var>global</var> be <var>realm</var>'s <span data-x="concept-realm-global">global
@@ -99220,8 +99275,11 @@ interface <dfn>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope</span> {
9922099275
<p>If <var>worker global scope</var>'s <span
9922199276
data-x="concept-WorkerGlobalScope-embedder-policy">embedder policy</span> is "<code
9922299277
data-x="coep-require-corp">require-corp</code>" and <var>is shared</var> is true, then set
99223-
<var>agent</var>'s <span>agent cluster</span>'s <span>cross-origin isolated</span> to
99224-
true.</p>
99278+
<var>agent</var>'s <span>agent cluster</span>'s <span
99279+
data-x="agent-cluster-cross-origin-isolation">cross-origin isolation mode</span> to "<code
99280+
data-x="cross-origin-isolation-logical">logical</code>" or "<code
99281+
data-x="cross-origin-isolation-concrete">concrete</code>". The one chosen is
99282+
<span>implementation-defined</span>.</p>
9922599283

9922699284
<p class="XXX">This really ought to be set when the agent cluster is created, which requires a
9922799285
redesign of this section.</p>
@@ -99234,8 +99292,9 @@ interface <dfn>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope</span> {
9923499292

9923599293
<li><p>Set <var>worker global scope</var>'s <span
9923699294
data-x="concept-WorkerGlobalScope-cross-origin-isolated-capability">cross-origin isolated
99237-
capability</span> to <var>agent</var>'s <span>agent cluster</span>'s <span>cross-origin
99238-
isolated</span>.</p></li>
99295+
capability</span> to true if <var>agent</var>'s <span>agent cluster</span>'s <span
99296+
data-x="agent-cluster-cross-origin-isolation">cross-origin isolation mode</span> is "<code
99297+
data-x="cross-origin-isolation-concrete">concrete</code>".</p></li>
9923999298

9924099299
<li><p>If <var>is shared</var> is false and <var>owner</var>'s <span
9924199300
data-x="concept-settings-object-cross-origin-isolated-capability">cross-origin isolated

0 commit comments

Comments
 (0)