Skip to content

Commit 9c0351e

Browse files
Make COOP+COEP do not imply crossOriginIsolated.
The [specification] currently requires [COOP] + [COEP] to give access to crossOriginIsolated capabilities like SharedArrayBuffer. Some platforms can't easily support multiple processes (like Android Webview). Therefore, they can't really support crossOriginIsolated. However the are no strong reasons for them not to enforce COEP (and maybe COOP) when their associated headers are present. It would be great enforcing COEP (and maybe COOP) on all platforms, desptie the lack of crossOriginIsolated capabilities. This patch makes the specification to allow (instead of requiring) platform to set the crossOriginIsolated flag when both COOP and COEP are used. Setting crossOriginIsolated becomes platform dependent. In exchange, we can enforce COEP (and COOP) in a non platform dependent way, without conflicting with the specification about crossOriginIsolated. [Bug]: #6060 [specification]: https://html.spec.whatwg.org/#cross-origin-opener-policies [COOP]: https://html.spec.whatwg.org/#cross-origin-opener-policy [COEP]: https://html.spec.whatwg.org/#coep
1 parent 7023892 commit 9c0351e

File tree

1 file changed

+110
-41
lines changed

1 file changed

+110
-41
lines changed

source

Lines changed: 110 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8088,15 +8088,6 @@ interface <dfn>DOMStringList</dfn> {
80888088
<li><p>Let <var>agentCluster</var> be the <span>surrounding agent</span>'s
80898089
<span>agent cluster</span>.</p></li>
80908090

8091-
<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>
8094-
8095-
<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>
8098-
</li>
8099-
81008091
<li><p>If <var>forStorage</var> is true, then throw a
81018092
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p></li>
81028093

@@ -8513,6 +8504,18 @@ o.myself = o;</code></pre>
85138504
<var>serialized</var>.[[AgentCluster]], then then throw a
85148505
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p></li>
85158506

8507+
<li><p>If <var>targetRealm</var>'s <span
8508+
data-x="concept-settings-object-cross-origin-isolated-capability"
8509+
>cross-origin isolated capability</span> is false, then throw
8510+
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p>
8511+
8512+
<p class="note">This check is only needed when deserializing (and not when serializing) as
8513+
<span data-x="concept-settings-object-cross-origin-isolated-capability">
8514+
cross-origin isolated capability</span> cannot change over time and a
8515+
<code>SharedArrayBuffer</code> cannot leave an <span>agent
8516+
cluster</span>.</p>
8517+
</li>
8518+
85168519
<li><p>Otherwise, set <var>value</var> to a new SharedArrayBuffer object in
85178520
<var>targetRealm</var> whose [[ArrayBufferData]] internal slot value is
85188521
<var>serialized</var>.[[ArrayBufferData]] and whose [[ArrayBufferByteLength]] internal slot
@@ -77984,8 +77987,43 @@ console.assert(iframeWindow.frameElement === null);
7798477987
keys</span> to <span data-x="agent cluster">agent clusters</span>). User agents are responsible
7798577988
for collecting agent clusters when it is deemed that nothing can access them anymore.</p>
7798677989

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>
77990+
<p>A <span>browsing context group</span> has a <dfn><var
77991+
data-x="bcg-cross-origin-isolation">cross-origin-isolation</var></dfn> variable of type
77992+
<span>cross-origin-isolation</span>. Initially set to"<code
77993+
data-x="cross-origin-isolation-none">isolation-none</code>"</p>
77994+
77995+
<p>A <dfn>cross-origin-isolation</dfn> type can take 3 possible values: </p>
77996+
<ul>
77997+
<li><dfn><code data-x="cross-origin-isolation-none">isolation-none</code></dfn></li>
77998+
<li><dfn><code data-x="cross-origin-isolation-logical">isolation-logical</code></dfn></li>
77999+
<li><dfn><code data-x="cross-origin-isolation-concrete">isolation-concrete</code></dfn></li>
78000+
</ul>
78001+
78002+
<div class="note">
78003+
<p>
78004+
<code data-x="cross-origin-isolation-logical">isolation-logical</code> and
78005+
<code data-x="cross-origin-isolation-concrete">isolation-concrete</code> are similar. They are both used
78006+
for <span>browsing context group</span>, where:
78007+
</p>
78008+
<ul>
78009+
<li><p>Every top-level <span>Document</span> has `<code data-x="">
78010+
<span data-x="http-cross-origin-opener-policy">Cross-Origin-Opener-Policy</span>:
78011+
<span data-x="coop-same-origin">same-origin</span></code>`</p></li>
78012+
78013+
<li><p>Every <span>Document</span> has
78014+
`<code data-x=""><span>Cross-Origin-Embedder-Policy</span>:
78015+
<span data-x="coep-require-corp">require-corp</span></code>`</p></li>
78016+
</ul>
78017+
<p>
78018+
On some platforms, it is difficult to provide the security properties required
78019+
by the <span data-x="concept-settings-object-cross-origin-isolated-capability">cross-origin
78020+
isolated capability</span>. As a result, only <code
78021+
data-x="cross-origin-isolation-concrete">isolation-concrete</code> can grant access to the <span
78022+
data-x="concept-settings-object-cross-origin-isolated-capability">cross-origin isolated
78023+
capability</span>. <code data-x="cross-origin-isolation-concrete">isolation-concrete</code> is
78024+
used on platform not supporting this capability.
78025+
</p>
78026+
</div>
7798978027

7799078028
<p>A <span>browsing context group</span> has an associated <dfn>historical agent cluster key
7799178029
map</dfn>, which is a <span data-x="ordered map">map</span> of <span
@@ -79645,11 +79683,17 @@ interface <dfn>BarProp</dfn> {
7964579683

7964679684
<dt>The <span data-x="concept-settings-object-cross-origin-isolated-capability">cross-origin
7964779685
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>
79686+
<dd><p>Return the logical conjunction of:</p>
79687+
<ol>
79688+
<li><p><var>realm</var>'s <span>agent cluster</span>'s <var
79689+
data-x="agent-cluster-cross-origin-isolation">cross-origin-isolation</var> is <code
79690+
data-x="cross-origin-isolation-concrete">isolation-concrete</code></p></li>
79691+
79692+
<li><p><span data-x="concept-document-window">associated <code>Document</code></span> is
79693+
<span>allowed to use</span> the "<code
79694+
data-x="cross-origin-isolated-feature">cross-origin-isolated</code>" feature.</p>
79695+
</ol>
79696+
</dd>
7965379697
</dl>
7965479698
</li>
7965579699

@@ -80424,8 +80468,9 @@ interface <dfn>BarProp</dfn> {
8042480468
a registrable domain suffix of and is not equal to</span> <var>effectiveDomain</var>, then throw
8042580469
a <span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p></li>
8042680470

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>
80471+
<li><p>If the <span>surrounding agent</span>'s <span>agent cluster</span>'s
80472+
<var data-x="agent-cluster-cross-origin-isolation">cross-origin-isolation</var> is not <code
80473+
data-x="cross-origin-isolation-none">isolation-none</code> then return.</p></li>
8042980474

8043080475
<li><p>If the <span>surrounding agent</span>'s <span>agent cluster</span>'s <span>is
8043180476
origin-keyed</span> is true, then return.</p></li>
@@ -80534,10 +80579,11 @@ interface <dfn>BarProp</dfn> {
8053480579
and the <code data-x="dom-originAgentCluster">originAgentCluster</code> getter will always return
8053580580
true.</p>
8053680581

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
80582+
<p class="note">Similarly, <code>Document</code>s with <span>agent cluster</span>'s
80583+
<var data-x="agent-cluster-cross-origin-isolation">cross-origin-isolated</var> not <code
80584+
data-x="cross-origin-isolation-none">isolation-none</code> are automatically origin-isolated. The
80585+
`<code data-x="http-origin-agent-cluster">Origin-Agent-Cluster</code>` header might be useful as
80586+
an additional hint to implementations about resource allocation, since the `<code
8054180587
data-x="http-cross-origin-opener-policy">Cross-Origin-Opener-Policy</code>` and
8054280588
`<code>Cross-Origin-Embedder-Policy</code>` headers used to achieve cross-origin isolation are
8054380589
more about ensuring that everything in the same address space opts in to being there. But adding
@@ -80901,8 +80947,9 @@ interface <dfn>BarProp</dfn> {
8090180947
<dd>
8090280948
<p>This behaves the same as "<code data-x="coop-same-origin">same-origin</code>", with the
8090380949
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>
80950+
group">group</span>'s <span data-x="bcg-cross-origin-isolation">cross-origin-isolation</span> to
80951+
<code data-x="cross-origin-isolation-logical">isolation-logical</code> or <code
80952+
data-x="cross-origin-isolation-concrete">isolation-concrete</code></p>
8090680953

8090780954
<p class="note">"<code data-x="coop-same-origin-plus-COEP">same-origin-plus-COEP</code>" cannot
8090880955
be directly set via the `<code
@@ -81311,8 +81358,19 @@ interface <dfn>BarProp</dfn> {
8131181358

8131281359
<li><p>If <var>navigationCOOP</var>'s <span data-x="coop-struct-value">value</span> is "<code
8131381360
data-x="coop-same-origin-plus-COEP">same-origin-plus-COEP</code>", then set
81314-
<var>newBrowsingContext</var>'s <span data-x="tlbc group">group</span>'s <span data-x="bcg
81315-
cross-origin isolated">cross-origin isolated</span> to true.</p></li>
81361+
<var>newBrowsingContext</var>'s <span data-x="tlbc group">group</span>'s <span
81362+
data-x="bcg-cross-origin-isolation">cross-origin-isolation</span> to: <code
81363+
data-x="cross-origin-isolation-logical">isolation-logical</code> or <code
81364+
data-x="cross-origin-isolation-concrete">isolation-concrete</code>. The one used is
81365+
platform-specific. </p>
81366+
81367+
<p class="note">It is difficult on some platforms to provide the security properties required by
81368+
the <span data-x="concept-settings-object-cross-origin-isolated-capability">cross-origin isolated
81369+
capability</span>. Only the <code
81370+
data-x="cross-origin-isolation-concrete">isolation-concrete</code> might grant access to it.
81371+
<code data-x="cross-origin-isolation-logical">Isolation-logical</code> won't and is used for the
81372+
platforms not supporting it.</p>
81373+
</li>
8131681374

8131781375
<li>
8131881376
<p>If <var>sandboxFlags</var> is not empty, then:</p>
@@ -86779,9 +86837,11 @@ interface <dfn>BeforeUnloadEvent</dfn> : <span>Event</span> {
8677986837
<p>Contains various <code>Window</code> objects which can potentially reach each other, either
8678086838
directly or by using <code data-x="dom-document-domain">document.domain</code>.</p>
8678186839

86782-
<p>If the encompassing <span>agent cluster</span>'s <span>cross-origin isolated</span> is true,
86783-
then all the <code>Window</code> objects will be <span>same origin</span>, can reach each other
86784-
directly, and <code data-x="dom-document-domain">document.domain</code> will no-op.</p>
86840+
<p>If the encompassing <span>agent cluster</span>'s <span
86841+
data-x="agent-cluster-cross-origin-isolation">cross-origin-isolation</span> is not <code
86842+
data-x="cross-origin-isolation-none">isolation-none</code>, then all the <code>Window</code>
86843+
objects will be <span>same origin</span>, can reach each other directly, and <code
86844+
data-x="dom-document-domain">document.domain</code> will no-op.</p>
8678586845

8678686846
<p class="note">Two <code>Window</code> objects that are <span>same origin</span> can be in
8678786847
different <span data-x="similar-origin window agent">similar-origin window agents</span>, for
@@ -86863,8 +86923,10 @@ interface <dfn>BeforeUnloadEvent</dfn> : <span>Event</span> {
8686386923

8686486924
<div w-nodev>
8686586925

86866-
<p>An <span>agent cluster</span> has an associated <dfn>cross-origin isolated</dfn> (a boolean),
86867-
which is initially false.</p>
86926+
<p>An <span>agent cluster</span> has an associated <dfn><var
86927+
data-x="agent-cluster-cross-origin-isolation">cross-origin-isolation</var></dfn> variable, of type
86928+
<span>cross-origin-isolation</span>. Initially set to <code
86929+
data-x="cross-origin-isolation-none">isolation-none</code>.
8686886930

8686986931
<p>An <span>agent cluster</span> has an associated <dfn>is origin-keyed</dfn> (a boolean), which
8687086932
is initially false.</p>
@@ -86892,8 +86954,10 @@ interface <dfn>BeforeUnloadEvent</dfn> : <span>Event</span> {
8689286954

8689386955
<li><p>Let <var>key</var> be <var>site</var>.</p></li>
8689486956

86895-
<li><p>If <var>group</var>'s <span data-x="bcg cross-origin isolated">cross-origin
86896-
isolated</span> is true, then set <var>key</var> to <var>origin</var>.</p></li>
86957+
<li><p>If <var>group</var>'s <span
86958+
data-x="bcg-cross-origin-isolation">cross-origin-isolation</span> is not <code
86959+
data-x="cross-origin-isolation-none">isolation-none</code>, then set <var>key</var> to
86960+
<var>origin</var>.</p></li>
8689786961

8689886962
<li><p>Otherwise, if <var>group</var>'s <span>historical agent cluster key
8689986963
map</span>[<var>origin</var>] <span data-x="map exists">exists</span>, then set <var>key</var> to
@@ -86918,8 +86982,9 @@ interface <dfn>BeforeUnloadEvent</dfn> : <span>Event</span> {
8691886982
<ol>
8691986983
<li><p>Let <var>agentCluster</var> be a new <span>agent cluster</span>.</p></li>
8692086984

86921-
<li><p>Set <var>agentCluster</var>'s <span>cross-origin isolated</span> to <var>group</var>'s
86922-
<span data-x="bcg cross-origin isolated">cross-origin isolated</span>.</p></li>
86985+
<li><p>Set <var>agentCluster</var>'s <var
86986+
data-x="agent-cluster-cross-origin-isolation">cross-origin-isolation</var> to <var>group</var>'s
86987+
<var data-x="bcg-cross-origin-isolation">cross-origin-isolation</var>.</p></li>
8692386988

8692486989
<li><p>Set <var>agentCluster</var>'s <span>is origin-keyed</span> to true if <var>key</var>
8692586990
equals <var>origin</var>; otherwise false.</p></li>
@@ -87300,8 +87365,9 @@ interface <dfn>BeforeUnloadEvent</dfn> : <span>Event</span> {
8730087365
href="https://github.com/tc39/ecma262/issues/1357">tc39/ecma262#1357</a>.</span></p></li>
8730187366

8730287367
<li>
87303-
<p>If <var>agent</var>'s <span>agent cluster</span>'s <span>cross-origin isolated</span> is
87304-
false, then:</p>
87368+
<p>If <var>agent</var>'s <span>agent cluster</span>'s <var
87369+
data-x="agent-cluster-cross-origin-isolation">cross-origin-isolation</var> is <code
87370+
data-x="cross-origin-isolation-none">isolation-none</code>, then:
8730587371

8730687372
<ol>
8730787373
<li><p>Let <var>global</var> be <var>realm</var>'s <span data-x="concept-realm-global">global
@@ -99221,8 +99287,11 @@ interface <dfn>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope</span> {
9922199287
<p>If <var>worker global scope</var>'s <span
9922299288
data-x="concept-WorkerGlobalScope-embedder-policy">embedder policy</span> is "<code
9922399289
data-x="coep-require-corp">require-corp</code>" and <var>is shared</var> is true, then set
99224-
<var>agent</var>'s <span>agent cluster</span>'s <span>cross-origin isolated</span> to
99225-
true.</p>
99290+
<var>agent</var>'s <span>agent cluster</span>'s <var
99291+
data-x="agent-cluster-cross-origin-isolation">cross-origin-isolated</var> to <code
99292+
data-x="cross-origin-isolation-logical">isolation-logical</code> or <code
99293+
data-x="cross-origin-isolation-concrete">isolation-concrete</code>. The one chosen is
99294+
platform-specific.</p>
9922699295

9922799296
<p class="XXX">This really ought to be set when the agent cluster is created, which requires a
9922899297
redesign of this section.</p>
@@ -99235,8 +99304,8 @@ interface <dfn>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope</span> {
9923599304

9923699305
<li><p>Set <var>worker global scope</var>'s <span
9923799306
data-x="concept-WorkerGlobalScope-cross-origin-isolated-capability">cross-origin isolated
99238-
capability</span> to <var>agent</var>'s <span>agent cluster</span>'s <span>cross-origin
99239-
isolated</span>.</p></li>
99307+
capability</span> to <var>agent</var>'s <span>agent cluster</span>'s <var
99308+
data-x="agent-cluster-cross-origin-isolation">cross-origin-isolation</var>.</p></li>
9924099309

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

0 commit comments

Comments
 (0)