-
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.
[shared storage] Implement the Shared-Storage-Cross-Origin-Worklet-Al…
…lowed response header check When creating a cross-origin worklet, require the "Shared-Storage-Cross-Origin-Worklet-Allowed: ?1" response header, or the request should fail (similar to the handling for CORS failure). Note that shared storage worklet request doesn't allow redirects, so it's sufficient to check inside `OnReceiveResponse` only. PR: WICG/shared-storage#131 Bug: 332564979 Change-Id: I6c2a07473527ede995cf4bd337d293f3168351bb
- Loading branch information
1 parent
2b71570
commit 30993ca
Showing
8 changed files
with
69 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
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
31 changes: 31 additions & 0 deletions
31
...orklet-failure-false-shared-storage-cross-origin-worklet-allowed.tentative.https.sub.html
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,31 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/common/utils.js"></script> | ||
<script src="/shared-storage/resources/util.js"></script> | ||
<script src="/fenced-frame/resources/utils.js"></script> | ||
|
||
<body> | ||
<script> | ||
'use strict'; | ||
|
||
promise_test(async t => { | ||
const ancestor_key = token(); | ||
const crossOrigin = 'https://{{domains[www]}}:{{ports[https][0]}}'; | ||
const helper_url = crossOrigin + | ||
`/shared-storage/resources/credentials-test-helper.py` + | ||
`?access_control_allow_origin_header=${window.origin}` + | ||
`&access_control_allow_credentials_header=true` + | ||
`&shared_storage_cross_origin_worklet_allowed_header=?0` + | ||
`&token=${ancestor_key}`; | ||
|
||
return promise_rejects_dom(t, "OperationError", | ||
sharedStorage.createWorklet( | ||
helper_url + `&action=store-cookie`, | ||
{ credentials: "include" })); | ||
}, 'createWorklet() with cross-origin module script and credentials ' + | ||
'"include", and with the Shared-Storage-Cross-Origin-Worklet-Allowed ' + | ||
'response header value set to false (?0)'); | ||
|
||
</script> | ||
</body> |
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
30 changes: 30 additions & 0 deletions
30
...klet-failure-missing-shared-storage-cross-origin-worklet-allowed.tentative.https.sub.html
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,30 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/common/utils.js"></script> | ||
<script src="/shared-storage/resources/util.js"></script> | ||
<script src="/fenced-frame/resources/utils.js"></script> | ||
|
||
<body> | ||
<script> | ||
'use strict'; | ||
|
||
promise_test(async t => { | ||
const ancestor_key = token(); | ||
const crossOrigin = 'https://{{domains[www]}}:{{ports[https][0]}}'; | ||
const helper_url = crossOrigin + | ||
`/shared-storage/resources/credentials-test-helper.py` + | ||
`?access_control_allow_origin_header=${window.origin}` + | ||
`&access_control_allow_credentials_header=true` + | ||
`&token=${ancestor_key}`; | ||
|
||
return promise_rejects_dom(t, "OperationError", | ||
sharedStorage.createWorklet( | ||
helper_url + `&action=store-cookie`, | ||
{ credentials: "include" })); | ||
}, 'createWorklet() with cross-origin module script and credentials ' + | ||
'"include", and without the Shared-Storage-Cross-Origin-Worklet-Allowed ' + | ||
'response header'); | ||
|
||
</script> | ||
</body> |
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