-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SAA] Extending Storage Access API to omit unpartitioned cookies
The current Storage Access API requires that unpartitioned cookie access is granted if any unpartitioned storage access is needed. This forces unpartitioned cookies to be included in network requests which may not need them, having impacts on network performance and security. Before the extension ships, we have a chance to fix this behavior without a compatibility break. Design Doc: https://docs.google.com/document/d/19qCGb4qwOcGiNrQM3ptWvRmB4JtpaTFgFVlWLXNOQ6c/edit Explainer: https://arichiv.github.io/saa-non-cookie-storage/omit-unpartitioned-cookies.html Bug: 1484966 Change-Id: Id0d29df0de173667b70d14761acdb95c543fea0f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5228597 Commit-Queue: Chris Fredrickson <[email protected]> Commit-Queue: Ari Chivukula <[email protected]> Auto-Submit: Ari Chivukula <[email protected]> Reviewed-by: Chris Fredrickson <[email protected]> Cr-Commit-Position: refs/heads/main@{#1252321}
- Loading branch information
1 parent
9d3b164
commit 35de43e
Showing
4 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
storage-access-api/storage-access-beyond-cookies.cookies.tentative.sub.https.window.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// META: script=/resources/testdriver.js | ||
// META: script=/resources/testdriver-vendor.js | ||
|
||
'use strict'; | ||
|
||
// Here's the set-up for this test: | ||
// Step 1 (top-frame) Set up listener for "HasAccess" message. | ||
// Step 2 (top-frame) Add data to first-party cookies. | ||
// Step 3 (top-frame) Embed an iframe that's cross-site with top-frame. | ||
// Step 4 (sub-frame) Try to use storage access API and read first-party data. | ||
// Step 5 (sub-frame) Embed an iframe that's same-origin with top-frame. | ||
// Step 6 (sub-sub-frame) Try to use storage access API and read first-party data. | ||
// Step 7 (sub-sub-frame) Send "HasAccess for cookies" message to top-frame. | ||
// Step 8 (top-frame) Cleanup. | ||
|
||
async_test(t => { | ||
// Step 1 | ||
window.addEventListener("message", t.step_func(e => { | ||
// Step 8 | ||
assert_equals(e.data, "HasAccess for cookies", "Storage Access API should be accessible and return first-party data"); | ||
test_driver.delete_all_cookies().then(t.step_func(() => { | ||
t.done(); | ||
})); | ||
})); | ||
|
||
// Step 2 | ||
const id = String(Date.now()); | ||
document.cookie = "test=" + id + "; SameSite=None; Secure"; | ||
|
||
// Step 3 | ||
let iframe = document.createElement("iframe"); | ||
iframe.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/storage-access-api/resources/storage-access-beyond-cookies-iframe.sub.html?type=cookies&id="+id; | ||
document.body.appendChild(iframe); | ||
}, "Verify StorageAccessAPIBeyondCookies for Cookies"); |
29 changes: 29 additions & 0 deletions
29
storage-access-api/storage-access-beyond-cookies.none.tentative.sub.https.window.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// META: script=/resources/testdriver.js | ||
// META: script=/resources/testdriver-vendor.js | ||
|
||
'use strict'; | ||
|
||
// Here's the set-up for this test: | ||
// Step 1 (top-frame) Set up listener for "HasAccess" message. | ||
// Step 2 (top-frame) Skipped in this test, but numbering must be consistent with other tests. | ||
// Step 3 (top-frame) Embed an iframe that's cross-site with top-frame. | ||
// Step 4 (sub-frame) Skipped in this test, but numbering must be consistent with other tests. | ||
// Step 5 (sub-frame) Embed an iframe that's same-origin with top-frame. | ||
// Step 6 (sub-sub-frame) Try to use storage access API without requesting anything. | ||
// Step 7 (sub-sub-frame) Send "HasAccess for none" message to top-frame. | ||
// Step 8 (top-frame) Cleanup. | ||
|
||
async_test(t => { | ||
// Step 1 | ||
window.addEventListener("message", t.step_func(e => { | ||
// Step 8 | ||
assert_equals(e.data, "HasAccess for none", "Storage Access API should not allow access for empty requests."); | ||
t.done(); | ||
})); | ||
|
||
// Step 2 | ||
// Step 3 | ||
let iframe = document.createElement("iframe"); | ||
iframe.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/storage-access-api/resources/storage-access-beyond-cookies-iframe.sub.html?type=none&id="; | ||
document.body.appendChild(iframe); | ||
}, "Verify StorageAccessAPIBeyondCookies for None"); |