From 42a4f90faeaa3f70d3938dca6b7b88b164ec738b Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Fri, 25 Oct 2024 14:37:43 -0400 Subject: [PATCH 01/11] Partition Blob URL fetches by Storage Key --- fetch.bs | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/fetch.bs b/fetch.bs index 3b18c5a7..a4d9e0d9 100644 --- a/fetch.bs +++ b/fetch.bs @@ -3132,6 +3132,27 @@ or an implementation-defined value. +

Storage keys for requests

+ +

Requests made to Blob URLs (other than those corresponding to navigations) are prevented from succeeding if the storage key for the environment making the request is different than the storage key of the where the Blob URL was created. [[STORAGE]] + +

+

To determine the storage key, given a request +request: + +

    +
  1. If request's reserved client is non-null, then return the + result of running obtain a storage key for non-storage purposes given request's + reserved client. [[!STORAGE]] + +

  2. If request's client is non-null, then return the + result of running obtain a storage key for non-storage purposes/a> given request's + client. [[!STORAGE]] + +

  3. Return null. +

+
+

HTTP cache partitions

@@ -4978,6 +4999,24 @@ steps:

The `GET` method restriction serves no useful purpose other than being interoperable. +

  • Let blob storage key be the result of running obtain a storage key for non-storage purposes with + blobURLEntry's environment settings object. [[!STORAGE]] + +

  • Let request storage key be the result of determining the storage key given request. + +

  • +

    If all of the following conditions are true: + +

    + +

    then return a network error. +

  • Let blob be blobURLEntry's object.

  • Let response be a new response. From 2d4567d05084c422bab06c8f24141689ca3569bd Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Fri, 25 Oct 2024 14:46:03 -0400 Subject: [PATCH 02/11] Fix formatting per the style guide --- fetch.bs | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/fetch.bs b/fetch.bs index a4d9e0d9..4884f346 100644 --- a/fetch.bs +++ b/fetch.bs @@ -3132,9 +3132,13 @@ or an implementation-defined value. +

    Storage keys for requests

    -

    Requests made to Blob URLs (other than those corresponding to navigations) are prevented from succeeding if the storage key for the environment making the request is different than the storage key of the where the Blob URL was created. [[STORAGE]] +

    Requests made to Blob URLs (other than those corresponding to navigations) are +prevented from succeeding if the storage key for the environment making the request +is different than the storage key of the where the Blob URL was created. +[[STORAGE]]

    To determine the storage key, given a request @@ -3142,11 +3146,11 @@ or an implementation-defined value.

    1. If request's reserved client is non-null, then return the - result of running obtain a storage key for non-storage purposes given request's - reserved client. [[!STORAGE]] + result of running obtain a storage key for non-storage purposes given + request's reserved client. [[!STORAGE]] -

    2. If request's client is non-null, then return the - result of running obtain a storage key for non-storage purposes/a> given request's +

    3. If request's client is non-null, then return the result of + running obtain a storage key for non-storage purposes/a> given request's client. [[!STORAGE]]

    4. Return null. @@ -4999,10 +5003,14 @@ steps:

      The `GET` method restriction serves no useful purpose other than being interoperable. -

    5. Let blob storage key be the result of running obtain a storage key for non-storage purposes with - blobURLEntry's environment settings object. [[!STORAGE]] +

    6. +

      Let blobStorageKey be the result of running + obtain a storage key for non-storage purposes with blobURLEntry's + environment settings object. [[!STORAGE]] -

    7. Let request storage key be the result of determining the storage key given request. +

    8. +

      Let requestStorageKey be the result of + determining the storage key given request.

    9. If all of the following conditions are true: @@ -5010,9 +5018,9 @@ steps:

      • request's mode is not "navigate" -

      • request storage key is non-null +

      • requestStorageKey is non-null -

      • request storage key is does not storage key equal blob storage key [[!STORAGE]] +

      • requestStorageKey is does not storage key equal blobStorageKey [[!STORAGE]]

      then return a network error. From e7689d696414719044eaf35a324e694cf7c1e316 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Fri, 25 Oct 2024 19:24:36 +0000 Subject: [PATCH 03/11] Fix build and formatting --- fetch.bs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/fetch.bs b/fetch.bs index 4884f346..c7e33ccd 100644 --- a/fetch.bs +++ b/fetch.bs @@ -3136,9 +3136,10 @@ or an implementation-defined value.

      Storage keys for requests

      Requests made to Blob URLs (other than those corresponding to navigations) are -prevented from succeeding if the storage key for the environment making the request -is different than the storage key of the where the Blob URL was created. -[[STORAGE]] +prevented from succeeding if the storage key of the +environment settings object making the request is different than the +storage key of the environment settings object corresponding to where +the Blob URL was created.

      To determine the storage key, given a request @@ -3147,11 +3148,11 @@ is different than the storage key of the where the Blob URL

      1. If request's reserved client is non-null, then return the result of running obtain a storage key for non-storage purposes given - request's reserved client. [[!STORAGE]] + request's reserved client.

      2. If request's client is non-null, then return the result of - running obtain a storage key for non-storage purposes/a> given request's - client. [[!STORAGE]] + running obtain a storage key for non-storage purposes given request's + client.

      3. Return null.

      @@ -5006,7 +5007,7 @@ steps:
    10. Let blobStorageKey be the result of running obtain a storage key for non-storage purposes with blobURLEntry's - environment settings object. [[!STORAGE]] + environment settings object.

    11. Let requestStorageKey be the result of @@ -5020,7 +5021,8 @@ steps:

    12. requestStorageKey is non-null -

    13. requestStorageKey is does not storage key equal blobStorageKey [[!STORAGE]] +

    14. requestStorageKey does not equal + blobStorageKey

      then return a network error. From f4f62bfa4eba4f0e69c4b0e1f3bdaf7eb01827be Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Fri, 25 Oct 2024 19:34:02 +0000 Subject: [PATCH 04/11] Add name to Acknowledgements section --- fetch.bs | 1 + 1 file changed, 1 insertion(+) diff --git a/fetch.bs b/fetch.bs index c7e33ccd..8abe2de7 100644 --- a/fetch.bs +++ b/fetch.bs @@ -9091,6 +9091,7 @@ Alexey Proskuryakov, Andreas Kling, Andrés Gutiérrez, Andrew Sutherland, +Andrew Williams, Ángel González, Anssi Kostiainen, Arkadiusz Michalski, From d79ae9647bbe63b30d75dee9191dd7ebe8f08436 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Fri, 22 Nov 2024 03:35:39 +0000 Subject: [PATCH 05/11] Address review feedback --- fetch.bs | 51 +++++++++++++++++++++------------------------------ 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/fetch.bs b/fetch.bs index 8abe2de7..44c4b250 100644 --- a/fetch.bs +++ b/fetch.bs @@ -3133,32 +3133,6 @@ or an implementation-defined value.

    -

    Storage keys for requests

    - -

    Requests made to Blob URLs (other than those corresponding to navigations) are -prevented from succeeding if the storage key of the -environment settings object making the request is different than the -storage key of the environment settings object corresponding to where -the Blob URL was created. - -

    -

    To determine the storage key, given a request -request: - -

      -
    1. If request's reserved client is non-null, then return the - result of running obtain a storage key for non-storage purposes given - request's reserved client. - -

    2. If request's client is non-null, then return the result of - running obtain a storage key for non-storage purposes given request's - client. - -

    3. Return null. -

    -
    - -

    HTTP cache partitions

    @@ -5007,7 +4981,7 @@ steps:
  • Let blobStorageKey be the result of running obtain a storage key for non-storage purposes with blobURLEntry's - environment settings object. + environment.

  • Let requestStorageKey be the result of @@ -5017,12 +4991,12 @@ steps:

    If all of the following conditions are true:

    then return a network error. @@ -5160,6 +5134,23 @@ steps: +

    +

    To determine the storage key, given a request +request: + +

      +
    1. If request's reserved client is non-null, then return the + result of running obtain a storage key for non-storage purposes given + request's reserved client. + +

    2. If request's client is non-null, then return the result of + running obtain a storage key for non-storage purposes given request's + client. + +

    3. Return null. +

    +
    +

    HTTP fetch

    From 0d6d692d3262ccbe25723792776a4ea97a60c147 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Mon, 25 Nov 2024 05:06:32 +0000 Subject: [PATCH 06/11] Move storage key check logic to FileAPI --- fetch.bs | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/fetch.bs b/fetch.bs index 44c4b250..eb6ce803 100644 --- a/fetch.bs +++ b/fetch.bs @@ -4978,30 +4978,19 @@ steps:

    The `GET` method restriction serves no useful purpose other than being interoperable. -

  • -

    Let blobStorageKey be the result of running - obtain a storage key for non-storage purposes with blobURLEntry's - environment. - -

  • -

    Let requestStorageKey be the result of - determining the storage key given request. +

  • Let requestEnvironment be the result of + determining the environment given request. -

  • -

    If all of the following conditions are true: +

  • Let isNavigation be true if request's mode is + not "navigate"; otherwise, false. -

    - -

    then return a network error. - -

  • Let blob be blobURLEntry's object. +

  • If blob is failure, then return a network error.

  • Let response be a new response. @@ -5135,17 +5124,15 @@ steps:

    -

    To determine the storage key, given a request +

    To determine the environment, given a request request:

      -
    1. If request's reserved client is non-null, then return the - result of running obtain a storage key for non-storage purposes given +

    2. If request's reserved client is non-null, then return request's reserved client. -

    3. If request's client is non-null, then return the result of - running obtain a storage key for non-storage purposes given request's - client. +

    4. If request's client is non-null, then return + request's client.

    5. Return null.

    From cacc4e5446899a259a8ec5f8fa309bc150f58df3 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Mon, 25 Nov 2024 14:03:45 +0000 Subject: [PATCH 07/11] Refactor existing use of blob URL entry object --- fetch.bs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fetch.bs b/fetch.bs index eb6ce803..d990d49a 100644 --- a/fetch.bs +++ b/fetch.bs @@ -4970,10 +4970,8 @@ steps: blob URL entry.
  • -

    If request's method is not `GET`, - blobURLEntry is null, or blobURLEntry's - object is not a {{Blob}} object, then return a - network error. [[!FILEAPI]] +

    If request's method is not `GET` or + blobURLEntry is null, then return a network error. [[!FILEAPI]]

    The `GET` method restriction serves no useful purpose other than being interoperable. @@ -4990,7 +4988,8 @@ steps:

  • Let blob be the result of obtaining a blob object given blobURLEntry, requestEnvironment, and isNavigation. -

  • If blob is failure, then return a network error. +

  • If blob is failure, or blob is not a {{Blob}} object, then + return a network error.

  • Let response be a new response. From 2f71ba00039d5534be0d965b6c1f38923e081807 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Thu, 28 Nov 2024 19:31:34 +0000 Subject: [PATCH 08/11] Address review feedback --- fetch.bs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/fetch.bs b/fetch.bs index d990d49a..3f8fb25c 100644 --- a/fetch.bs +++ b/fetch.bs @@ -4979,17 +4979,22 @@ steps:

  • Let requestEnvironment be the result of determining the environment given request. -

  • Let isNavigation be true if request's mode is - not "navigate"; otherwise, false. +

  • Let isTopLevelNavigation be true if request's destination is "document"; otherwise, false. -

  • If isNavigation is false and requestEnvironment is null, then - return a network error. +

  • If isTopLevelNavigation is false and requestEnvironment is null, + then return a network error. + +

  • Let blob be null. + +

  • If isTopLevelNavigation is true, then set blob to the result of + obtaining a blob object given blobURLEntry and the string + "navigation". -

  • Let blob be the result of obtaining a blob object given - blobURLEntry, requestEnvironment, and isNavigation. +

  • Otherwise, set blob to the result of obtaining a blob object given + blobURLEntry and requestEnvironment. -

  • If blob is failure, or blob is not a {{Blob}} object, then - return a network error. +

  • If blob is not a {{Blob}} object, then return a network error.

  • Let response be a new response. From c201d79a3475df48a02ae149328d614621441eaf Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Thu, 5 Dec 2024 03:31:41 +0000 Subject: [PATCH 09/11] Fix reference to 'Obtain a blob URL' --- fetch.bs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fetch.bs b/fetch.bs index 3f8fb25c..e6a3e068 100644 --- a/fetch.bs +++ b/fetch.bs @@ -4988,10 +4988,11 @@ steps:

  • Let blob be null.

  • If isTopLevelNavigation is true, then set blob to the result of - obtaining a blob object given blobURLEntry and the string - "navigation". + obtaining a blob object + given blobURLEntry and the string "navigation". -

  • Otherwise, set blob to the result of obtaining a blob object given +

  • Otherwise, set blob to the result of obtaining a blob object given blobURLEntry and requestEnvironment.

  • If blob is not a {{Blob}} object, then return a network error. From 0b5fccbbddec53a3ada37edfa0a5c89e1eb7b556 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Fri, 6 Dec 2024 23:00:47 +0000 Subject: [PATCH 10/11] Simplify based on review feedback --- fetch.bs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fetch.bs b/fetch.bs index e6a3e068..9676a75d 100644 --- a/fetch.bs +++ b/fetch.bs @@ -4985,15 +4985,11 @@ steps:

  • If isTopLevelNavigation is false and requestEnvironment is null, then return a network error. -

  • Let blob be null. +

  • Let navigationOrEnvironment be the string "navigation" if + isTopLevelNavigation is true; otherwise, requestEnvironment. -

  • If isTopLevelNavigation is true, then set blob to the result of - obtaining a blob object - given blobURLEntry and the string "navigation". - -

  • Otherwise, set blob to the result of obtaining a blob object given - blobURLEntry and requestEnvironment. +

  • Let blob be the result of obtaining a blob object given + blobURLEntry and navigationOrEnvironment.

  • If blob is not a {{Blob}} object, then return a network error. From ddae2dce0fd2f7ea8f2a01ac4ddee93d19a2e5fe Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Fri, 6 Dec 2024 23:16:52 +0000 Subject: [PATCH 11/11] Minor text wrapping change for consistency --- fetch.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fetch.bs b/fetch.bs index 9676a75d..9c2179d1 100644 --- a/fetch.bs +++ b/fetch.bs @@ -4979,8 +4979,8 @@ steps:

  • Let requestEnvironment be the result of determining the environment given request. -

  • Let isTopLevelNavigation be true if request's destination is "document"; otherwise, false. +

  • Let isTopLevelNavigation be true if request's + destination is "document"; otherwise, false.

  • If isTopLevelNavigation is false and requestEnvironment is null, then return a network error.