From 00564b8c5f510952208420857d1737e5ea2cca02 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 25 Jun 2019 17:12:37 +0200 Subject: [PATCH] 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. --- source | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/source b/source index 140a2eb94fa..5918b2bda28 100644 --- a/source +++ b/source @@ -8301,13 +8301,26 @@ interface DOMStringList {

If ! IsSharedArrayBuffer(value) is true, then:

    +
  1. Let agentCluster be surrounding agent's + agent cluster.

  2. + +
  3. +

    If agentCluster's cross-origin isolated is false, then throw a + + "DataCloneError" DOMException.

    + +

    This check is only needed when serializing (and not when deserializing) as + cross-origin isolated cannot change over time and a + SharedArrayBuffer cannot leave an agent cluster.

    +
  4. +
  5. If forStorage is true, then throw a "DataCloneError" DOMException.

  6. Set serialized to { [[Type]]: "SharedArrayBuffer", [[ArrayBufferData]]: value.[[ArrayBufferData]], [[ArrayBufferByteLength]]: size, - [[AgentCluster]]: the current Realm Record's corresponding agent - cluster }.

  7. + [[AgentCluster]]: agentCluster }.

@@ -95774,6 +95787,9 @@ dictionary ImageBitmapOptions { are:

    +
  1. Set serialized.[[CrossOriginIsolated]] to surrounding agent's + agent cluster's cross-origin isolated.

  2. +
  3. Set serialized.[[BitmapData]] to a copy of value's bitmap data.

  4. @@ -95786,6 +95802,17 @@ dictionary ImageBitmapOptions { are:

      +
    1. +

      If serialized.[[OriginClean]] is false, + serialized.[[CrossOriginIsolated]] is false, and surrounding agent's + agent cluster's cross-origin isolated is true, then throw a + "DataCloneError" DOMException.

      + +

      To truly protect against sidechannel attacks implementations should avoid + transmitting serialized.[[BitmapData]] to the surrounding agent's + agent cluster under the above conditions.

      +
    2. +
    3. Set value's bitmap data to serialized.[[BitmapData]].

    4. @@ -95796,6 +95823,9 @@ dictionary ImageBitmapOptions {

      Their transfer steps, given value and dataHolder, are:

        +
      1. Set dataHolder.[[CrossOriginIsolated]] to surrounding agent's + agent cluster's cross-origin isolated.

      2. +
      3. Set dataHolder.[[BitmapData]] to value's bitmap data.

      4. @@ -95811,6 +95841,18 @@ dictionary ImageBitmapOptions { are:

          +
        1. +

          If dataHolder.[[OriginClean]] is false, + dataHolder.[[CrossOriginIsolated]] is false, and surrounding agent's + agent cluster's cross-origin isolated is true, then throw a + "DataCloneError" DOMException.

          + + +

          To truly protect against sidechannel attacks implementations should avoid + sharing dataHolder.[[BitmapData]] with surrounding agent's + agent cluster under the above conditions.

          +
        2. +
        3. Set value's bitmap data to dataHolder.[[BitmapData]].