Skip to content

Commit 68d940c

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 68d940c

File tree

1 file changed

+111
-44
lines changed

1 file changed

+111
-44
lines changed

source

Lines changed: 111 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8017,7 +8017,7 @@ interface <dfn>DOMStringList</dfn> {
80178017

80188018
<h4 id="structuredserializeinternal" noexport data-lt="StructuredSerializeInternal"
80198019
abstract-op><dfn>StructuredSerializeInternal</dfn> ( <var>value</var>, <var>forStorage</var> [ ,
8020-
<var>memory</var> ] )</h4>
8020+
<var>memory</var> ])</h4>
80218021

80228022
<p>The <span>StructuredSerializeInternal</span> abstract operation takes as input a JavaScript
80238023
value <var>value</var> and serializes it to a <span data-x="JavaScript
@@ -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 "<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,17 +80579,16 @@ 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
8054480590
it would have no additional observable effects on author code.</p>
8054580591

80546-
80547-
8054880592
<h3>Sandboxing</h3>
8054980593

8055080594
<p>A <dfn export>sandboxing flag set</dfn> is a set of zero or more of the following flags, which
@@ -80901,8 +80945,9 @@ interface <dfn>BarProp</dfn> {
8090180945
<dd>
8090280946
<p>This behaves the same as "<code data-x="coop-same-origin">same-origin</code>", with the
8090380947
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>
80948+
group">group</span>'s <span data-x="bcg-cross-origin-isolation">cross-origin-isolation</span> to
80949+
<code data-x="cross-origin-isolation-logical">isolation-logical</code> or <code
80950+
data-x="cross-origin-isolation-concrete">isolation-concrete</code></p>
8090680951

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

8131281357
<li><p>If <var>navigationCOOP</var>'s <span data-x="coop-struct-value">value</span> is "<code
8131381358
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>
81359+
<var>newBrowsingContext</var>'s <span data-x="tlbc group">group</span>'s <span
81360+
data-x="bcg-cross-origin-isolation">cross-origin-isolation</span> to: <code
81361+
data-x="cross-origin-isolation-logical">isolation-logical</code> or <code
81362+
data-x="cross-origin-isolation-concrete">isolation-concrete</code>. The one used is
81363+
platform-specific. </p>
81364+
81365+
<p class="note">It is difficult on some platforms to provide the security properties required by
81366+
the <span data-x="concept-settings-object-cross-origin-isolated-capability">cross-origin isolated
81367+
capability</span>. Only the <code
81368+
data-x="cross-origin-isolation-concrete">isolation-concrete</code> might grant access to it.
81369+
<code data-x="cross-origin-isolation-logical">Isolation-logical</code> won't and is used for the
81370+
platforms not supporting it.</p>
81371+
</li>
8131681372

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

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>
86838+
<p>If the encompassing <span>agent cluster</span>'s <span
86839+
data-x="agent-cluster-cross-origin-isolation">cross-origin-isolation</span> is not <code
86840+
data-x="cross-origin-isolation-none">isolation-none</code>, then all the <code>Window</code>
86841+
objects will be <span>same origin</span>, can reach each other directly, and <code
86842+
data-x="dom-document-domain">document.domain</code> will no-op.</p>
8678586843

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

8686486922
<div w-nodev>
8686586923

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

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

8689386953
<li><p>Let <var>key</var> be <var>site</var>.</p></li>
8689486954

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>
86955+
<li><p>If <var>group</var>'s <span
86956+
data-x="bcg-cross-origin-isolation">cross-origin-isolation</span> is not <code
86957+
data-x="cross-origin-isolation-none">isolation-none</code>, then set <var>key</var> to
86958+
<var>origin</var>.</p></li>
8689786959

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

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>
86983+
<li><p>Set <var>agentCluster</var>'s <var
86984+
data-x="agent-cluster-cross-origin-isolation">cross-origin-isolation</var> to <var>group</var>'s
86985+
<var data-x="bcg-cross-origin-isolation">cross-origin-isolation</var>.</p></li>
8692386986

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

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

8730687370
<ol>
8730787371
<li><p>Let <var>global</var> be <var>realm</var>'s <span data-x="concept-realm-global">global
@@ -99221,8 +99285,11 @@ interface <dfn>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope</span> {
9922199285
<p>If <var>worker global scope</var>'s <span
9922299286
data-x="concept-WorkerGlobalScope-embedder-policy">embedder policy</span> is "<code
9922399287
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>
99288+
<var>agent</var>'s <span>agent cluster</span>'s <var
99289+
data-x="agent-cluster-cross-origin-isolation">cross-origin-isolated</var> to <code
99290+
data-x="cross-origin-isolation-logical">isolation-logical</code> or <code
99291+
data-x="cross-origin-isolation-concrete">isolation-concrete</code>. The one chosen is
99292+
platform-specific.</p>
9922699293

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

9923699303
<li><p>Set <var>worker global scope</var>'s <span
9923799304
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>
99305+
capability</span> to <var>agent</var>'s <span>agent cluster</span>'s <var
99306+
data-x="agent-cluster-cross-origin-isolation">cross-origin-isolation</var>.</p></li>
9924099307

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

0 commit comments

Comments
 (0)