Skip to content

Commit 00564b8

Browse files
committed
Raise the bar for SharedArrayBuffer via postMessage()
This depends on the work to add Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy. It specifies how postMessage() is affected when both those headers are set for the agent clusters they impact. Closes #4732.
1 parent 3f3b8c2 commit 00564b8

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

source

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8301,13 +8301,26 @@ interface <dfn>DOMStringList</dfn> {
83018301
<p>If ! <span>IsSharedArrayBuffer</span>(<var>value</var>) is true, then:
83028302

83038303
<ol>
8304+
<li><p>Let <var>agentCluster</var> be <span>surrounding agent</span>'s
8305+
<span>agent cluster</span>.</p></li>
8306+
8307+
<li>
8308+
<p>If <var>agentCluster</var>'s <dfn>cross-origin isolated</dfn> is false, then throw a
8309+
<!-- TODO: this is not the place to <dfn> this, but doing this for now so the build does not
8310+
fail -->
8311+
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p>
8312+
8313+
<p class="note">This check is only needed when serializing (and not when deserializing) as
8314+
<span>cross-origin isolated</span> cannot change over time and a
8315+
<code>SharedArrayBuffer</code> cannot leave an <span>agent cluster</span>.</p>
8316+
</li>
8317+
83048318
<li><p>If <var>forStorage</var> is true, then throw a
83058319
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p></li>
83068320

83078321
<li><p>Set <var>serialized</var> to { [[Type]]: "SharedArrayBuffer", [[ArrayBufferData]]:
83088322
<var>value</var>.[[ArrayBufferData]], [[ArrayBufferByteLength]]: <var>size</var>,
8309-
[[AgentCluster]]: the <span>current Realm Record</span>'s corresponding <span>agent
8310-
cluster</span> }.</p></li>
8323+
[[AgentCluster]]: <var>agentCluster</var> }.</p></li>
83118324
</ol>
83128325
</li>
83138326

@@ -95774,6 +95787,9 @@ dictionary <dfn>ImageBitmapOptions</dfn> {
9577495787
are:</p>
9577595788

9577695789
<ol>
95790+
<li><p>Set <var>serialized</var>.[[CrossOriginIsolated]] to <span>surrounding agent</span>'s
95791+
<span>agent cluster</span>'s <span>cross-origin isolated</span>.</p></li>
95792+
9577795793
<li><p>Set <var>serialized</var>.[[BitmapData]] to a copy of <var>value</var>'s <span
9577895794
data-x="concept-ImageBitmap-bitmap-data">bitmap data</span>.</p></li>
9577995795

@@ -95786,6 +95802,17 @@ dictionary <dfn>ImageBitmapOptions</dfn> {
9578695802
are:</p>
9578795803

9578895804
<ol>
95805+
<li>
95806+
<p>If <var>serialized</var>.[[OriginClean]] is false,
95807+
<var>serialized</var>.[[CrossOriginIsolated]] is false, and <span>surrounding agent</span>'s
95808+
<span>agent cluster</span>'s <span>cross-origin isolated</span> is true, then throw a
95809+
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p>
95810+
95811+
<p class="warning">To truly protect against sidechannel attacks implementations should avoid
95812+
transmitting <var>serialized</var>.[[BitmapData]] to the <span>surrounding agent</span>'s
95813+
<span>agent cluster</span> under the above conditions.</p>
95814+
</li>
95815+
9578995816
<li><p>Set <var>value</var>'s <span data-x="concept-ImageBitmap-bitmap-data">bitmap data</span>
9579095817
to <var>serialized</var>.[[BitmapData]].</p></li>
9579195818

@@ -95796,6 +95823,9 @@ dictionary <dfn>ImageBitmapOptions</dfn> {
9579695823
<p>Their <span>transfer steps</span>, given <var>value</var> and <var>dataHolder</var>, are:</p>
9579795824

9579895825
<ol>
95826+
<li><p>Set <var>dataHolder</var>.[[CrossOriginIsolated]] to <span>surrounding agent</span>'s
95827+
<span>agent cluster</span>'s <span>cross-origin isolated</span>.</p></li>
95828+
9579995829
<li><p>Set <var>dataHolder</var>.[[BitmapData]] to <var>value</var>'s <span
9580095830
data-x="concept-ImageBitmap-bitmap-data">bitmap data</span>.</p></li>
9580195831

@@ -95811,6 +95841,18 @@ dictionary <dfn>ImageBitmapOptions</dfn> {
9581195841
are:</p>
9581295842

9581395843
<ol>
95844+
<li>
95845+
<p>If <var>dataHolder</var>.[[OriginClean]] is false,
95846+
<var>dataHolder</var>.[[CrossOriginIsolated]] is false, and <span>surrounding agent</span>'s
95847+
<span>agent cluster</span>'s <span>cross-origin isolated</span> is true, then throw a
95848+
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p>
95849+
<!-- E.g., when a COEP shared worker receives an ImageBitmap from a non-COOP+COEP window. -->
95850+
95851+
<p class="warning">To truly protect against sidechannel attacks implementations should avoid
95852+
sharing <var>dataHolder</var>.[[BitmapData]] with <span>surrounding agent</span>'s
95853+
<span>agent cluster</span> under the above conditions.</p>
95854+
</li>
95855+
9581495856
<li><p>Set <var>value</var>'s <span data-x="concept-ImageBitmap-bitmap-data">bitmap data</span>
9581595857
to <var>dataHolder</var>.[[BitmapData]].</p></li>
9581695858

0 commit comments

Comments
 (0)