-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cache.match() and COEP #1490
Comments
There shouldn't be a COEP/CORP check for non-opaque responses (such as a CORS response). Our thinking about this so far has been that if the opaque response only holds a handle to the actual secret and there's no way for the secret to enter the content process there's no problem and no need for API changes. But I don't care strongly. |
@annevk, If I fully understand what you said: From a document with |
Yeah, https://mikewest.github.io/corpp/#abstract-opdef-cross-origin-resource-policy-check exits early with allowed for such a case, no? |
Ok, ignore the comment about CORS responses then. Sorry for my confusion. It still feels more clear to me to reject the match() call instead of returning an opaque response that may blow up when passed to respondWith() further along. And may leak headers via spectre. |
If it's not just a handle things will leak, agreed. And it might therefore be worthwhile to block earlier on. Firefox will implement COEP service/shared workers later on, but I suspect similar considerations apply and unless Andrew/Perry feel otherwise I think we'd be okay with blocking early. |
I'm fairly confident both chrome/firefox store and retrieve the full internal headers for opaque responses. In addition, both browsers do some amount of eager reading of the body data under different circumstances. It would be possible to fix all that for COEP, but its much safer to never allow these Response objects to enter the child/renderer process at all. |
Yes, @wanderview is right that Firefox currently sends all the data about opaque responses to the content processes and only creates the opaque wrapped response when processing the received IPC data, which is too late. I think bug 1565199 covers the general scenario for Firefox. The most recent thoughts @perryjiang and I had on this were that we would run the same CORP check on cache.match() responses and at least, for now, send a pre-opaqued response that can't be used for anything. (That is, there's just a opaque filtered response and any attempt to consume the underlying response will fail with a corp-check (network) error.) API-wise, it seems like there are 5 options:
The Responses-get-nulled situation is similar to Blob edge-cases where a The Responses-are-handles situation is sorta analogous to the current MessagePort.postMessage of a SharedArrayBuffer. Because you can never reason about what global the serialized payload will be deserialized in because the ports can always be shipped, there are cases where it's safe to ship the data itself, and there are times when you have to be shipping around a handle. However, in that case we fail to deserialize the entire serialized object due to the SAB, not creating a nulled SAB reference. I don't have any specific proposal other than banding together to build a gateway to a parallel universe without SPECTRE attacks. |
I think these issues are only problematic for sites that want some contexts COEP protected and some other contexts non-COEP protected. This seems like an unusual use case. Also, IDB support for responses does not exist today and I haven't seen any movement towards making it happen. Its easier to relax the rejecting behavior if we need to support something like that in the future than it is to claw back the returned Response. I feel pretty strongly we should start by rejecting cache.match() and cache.matchAll(). |
It's definitely easy to implement and easy to relax. I've filed https://bugzilla.mozilla.org/show_bug.cgi?id=1603168 for the specific implementation in Firefox and we'll likely implement it in the near future. |
[PROTOTYPE] => DO NOT COMMIT. Document using: "Cross-Origin-Embedder-Policy: require-corp" must not access cross-origin response that do not have the header: "Cross-Origin-Resource-Policy: cross-site" This is about only no-cors requests. CORS requests are checked against the CORS headers instead. See: - whatwg/fetch#985 - w3c/ServiceWorker#1490 Bug:1031542 Change-Id: I94a2cb9435fcf3e76f57a8f3d3344c87fa23f9a9
[PROTOTYPE] => DO NOT COMMIT. Document using: "Cross-Origin-Embedder-Policy: require-corp" must not access cross-origin response that do not have the header: "Cross-Origin-Resource-Policy: cross-site" This is about only no-cors requests. CORS requests are checked against the CORS headers instead. See: - whatwg/fetch#985 - w3c/ServiceWorker#1490 Bug:1031542 Change-Id: I94a2cb9435fcf3e76f57a8f3d3344c87fa23f9a9
[PROTOTYPE] => DO NOT COMMIT. Document using: "Cross-Origin-Embedder-Policy: require-corp" must not access cross-origin response that do not have the header: "Cross-Origin-Resource-Policy: cross-site" This is about only no-cors requests. CORS requests are checked against the CORS headers instead. See: - whatwg/fetch#985 - w3c/ServiceWorker#1490 Bug:1031542 Change-Id: I94a2cb9435fcf3e76f57a8f3d3344c87fa23f9a9
We also need to define what error type must be returned when cache.match is blocked by CORP checks. Do you have an opinion? |
[PROTOTYPE] => DO NOT COMMIT. Document using: "Cross-Origin-Embedder-Policy: require-corp" must not access cross-origin response that do not have the header: "Cross-Origin-Resource-Policy: cross-site" This is about only no-cors requests. CORS requests are checked against the CORS headers instead. See: - whatwg/fetch#985 - w3c/ServiceWorker#1490 Bug:1031542 Change-Id: I94a2cb9435fcf3e76f57a8f3d3344c87fa23f9a9
Document using: "Cross-Origin-Embedder-Policy: require-corp" must not access cross-origin response that do not have the header: "Cross-Origin-Resource-Policy: cross-site" This is about only no-cors requests. CORS requests are checked against the CORS headers instead. See: - whatwg/fetch#985 - w3c/ServiceWorker#1490 Bug:1031542 Change-Id: I94a2cb9435fcf3e76f57a8f3d3344c87fa23f9a9
Document using: "Cross-Origin-Embedder-Policy: require-corp" must not access cross-origin response that do not have the header: "Cross-Origin-Resource-Policy: cross-site" This is about only no-cors requests. CORS requests are checked against the CORS headers instead. See: - whatwg/fetch#985 - w3c/ServiceWorker#1490 Bug:1031542 Change-Id: I94a2cb9435fcf3e76f57a8f3d3344c87fa23f9a9
Document using: "Cross-Origin-Embedder-Policy: require-corp" must not access cross-origin response that do not have the header: "Cross-Origin-Resource-Policy: cross-site" This is about only no-cors requests. CORS requests are checked against the CORS headers instead. See: - whatwg/fetch#985 - w3c/ServiceWorker#1490 Bug:1031542 Change-Id: I94a2cb9435fcf3e76f57a8f3d3344c87fa23f9a9
Document using: "Cross-Origin-Embedder-Policy: require-corp" must not access cross-origin response that do not have the header: "Cross-Origin-Resource-Policy: cross-site" This is about only no-cors requests. CORS requests are checked against the CORS headers instead. See: - whatwg/fetch#985 - w3c/ServiceWorker#1490 Bug:1031542 Change-Id: I94a2cb9435fcf3e76f57a8f3d3344c87fa23f9a9
Document using: "Cross-Origin-Embedder-Policy: require-corp" must not access cross-origin response that do not have the header: "Cross-Origin-Resource-Policy: cross-site" This is about only no-cors requests. CORS requests are checked against the CORS headers instead. See: - whatwg/fetch#985 - w3c/ServiceWorker#1490 Bug: 1031542 Change-Id: I94a2cb9435fcf3e76f57a8f3d3344c87fa23f9a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1973913 Auto-Submit: Arthur Sonzogni <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Reviewed-by: Ben Kelly <[email protected]> Reviewed-by: Mike West <[email protected]> Commit-Queue: Arthur Sonzogni <[email protected]> Cr-Commit-Position: refs/heads/master@{#726782}
Document using: "Cross-Origin-Embedder-Policy: require-corp" must not access cross-origin response that do not have the header: "Cross-Origin-Resource-Policy: cross-site" This is about only no-cors requests. CORS requests are checked against the CORS headers instead. See: - whatwg/fetch#985 - w3c/ServiceWorker#1490 Bug: 1031542 Change-Id: I94a2cb9435fcf3e76f57a8f3d3344c87fa23f9a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1973913 Auto-Submit: Arthur Sonzogni <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Reviewed-by: Ben Kelly <[email protected]> Reviewed-by: Mike West <[email protected]> Commit-Queue: Arthur Sonzogni <[email protected]> Cr-Commit-Position: refs/heads/master@{#726782}
…estonly Automatic update from web-platform-tests COEP: Enforce CORP in cache.match() Document using: "Cross-Origin-Embedder-Policy: require-corp" must not access cross-origin response that do not have the header: "Cross-Origin-Resource-Policy: cross-site" This is about only no-cors requests. CORS requests are checked against the CORS headers instead. See: - whatwg/fetch#985 - w3c/ServiceWorker#1490 Bug: 1031542 Change-Id: I94a2cb9435fcf3e76f57a8f3d3344c87fa23f9a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1973913 Auto-Submit: Arthur Sonzogni <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Reviewed-by: Ben Kelly <[email protected]> Reviewed-by: Mike West <[email protected]> Commit-Queue: Arthur Sonzogni <[email protected]> Cr-Commit-Position: refs/heads/master@{#726782} -- wpt-commits: 236e6dbc70e128ab5ff5bad6ab98888281df8ffd wpt-pr: 20840
…estonly Automatic update from web-platform-tests COEP: Enforce CORP in cache.match() Document using: "Cross-Origin-Embedder-Policy: require-corp" must not access cross-origin response that do not have the header: "Cross-Origin-Resource-Policy: cross-site" This is about only no-cors requests. CORS requests are checked against the CORS headers instead. See: - whatwg/fetch#985 - w3c/ServiceWorker#1490 Bug: 1031542 Change-Id: I94a2cb9435fcf3e76f57a8f3d3344c87fa23f9a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1973913 Auto-Submit: Arthur Sonzogni <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Reviewed-by: Ben Kelly <[email protected]> Reviewed-by: Mike West <[email protected]> Commit-Queue: Arthur Sonzogni <[email protected]> Cr-Commit-Position: refs/heads/master@{#726782} -- wpt-commits: 236e6dbc70e128ab5ff5bad6ab98888281df8ffd wpt-pr: 20840
I think I'd prefer a |
TypeError is more consistent with the overall API. See w3c/ServiceWorker#1490 (comment).
TypeError is more consistent with the overall API. See w3c/ServiceWorker#1490 (comment).
…testonly Automatic update from web-platform-tests COEP: change cache.match() exception TypeError is more consistent with the overall API. See w3c/ServiceWorker#1490 (comment). -- wpt-commits: 7feb47d66b5197715742d0aaff8c9cf0230b8cd1 wpt-pr: 21856
…testonly Automatic update from web-platform-tests COEP: change cache.match() exception TypeError is more consistent with the overall API. See w3c/ServiceWorker#1490 (comment). -- wpt-commits: 7feb47d66b5197715742d0aaff8c9cf0230b8cd1 wpt-pr: 21856 UltraBlame original commit: 88d4932e7da4b199cd3761e286f9a6b25bac5f0f
…testonly Automatic update from web-platform-tests COEP: change cache.match() exception TypeError is more consistent with the overall API. See w3c/ServiceWorker#1490 (comment). -- wpt-commits: 7feb47d66b5197715742d0aaff8c9cf0230b8cd1 wpt-pr: 21856
@yutakahirano it doesn't seem this change is captured by https://wicg.github.io/cross-origin-embedder-policy/ at the moment. Where is this captured in specification text? |
I'm making a service worker spec PR which includes the change. |
Merges https://github.com/WICG/cross-origin-embedder-policy into HTML. Associated PRs: * whatwg/fetch#1030 * w3c/ServiceWorker#1516 * w3c/css-houdini-drafts#992 Fixes #5368, fixes #5634, fixes whatwg/fetch#985, and fixes w3c/ServiceWorker#1490. Follow-up: #4916, #4919, #4930 #5223, and #5391. (As well as defining cross-origin isolated, per #4732.)
Merges https://github.com/WICG/cross-origin-embedder-policy into HTML. Associated PRs: * whatwg/fetch#1030 * w3c/ServiceWorker#1516 * w3c/css-houdini-drafts#992 Fixes whatwg#5368, fixes whatwg#5634, fixes whatwg/fetch#985, and fixes w3c/ServiceWorker#1490. Follow-up: whatwg#4916, whatwg#4919, whatwg#4930 whatwg#5223, and whatwg#5391. (As well as defining cross-origin isolated, per whatwg#4732.)
Add tentative WPT tests about COEP and CacheStorage. Issues: - COEP:require-corp: w3c/ServiceWorker#1490 - COEP:credentialless: w3c/ServiceWorker#1592 Bug:1175099 Change-Id: I857adbd134443b17b9689c314307bb1e3888235b
Add tentative WPT tests about COEP and CacheStorage. Issues: - COEP:require-corp: w3c/ServiceWorker#1490 - COEP:credentialless: w3c/ServiceWorker#1592 Bug:1175099 Change-Id: I857adbd134443b17b9689c314307bb1e3888235b
Add tentative WPT tests about COEP and CacheStorage. Issues: - COEP:require-corp: w3c/ServiceWorker#1490 - COEP:credentialless: w3c/ServiceWorker#1592 Bug: 1175099 Change-Id: I857adbd134443b17b9689c314307bb1e3888235b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2876191 Commit-Queue: Arthur Sonzogni <[email protected]> Reviewed-by: Antonio Sartori <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Cr-Commit-Position: refs/heads/master@{#880447}
Add tentative WPT tests about COEP and CacheStorage. Issues: - COEP:require-corp: w3c/ServiceWorker#1490 - COEP:credentialless: w3c/ServiceWorker#1592 Bug: 1175099 Change-Id: I857adbd134443b17b9689c314307bb1e3888235b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2876191 Commit-Queue: Arthur Sonzogni <[email protected]> Reviewed-by: Antonio Sartori <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Cr-Commit-Position: refs/heads/master@{#880447}
Add tentative WPT tests about COEP and CacheStorage. Issues: - COEP:require-corp: w3c/ServiceWorker#1490 - COEP:credentialless: w3c/ServiceWorker#1592 Bug: 1175099 Change-Id: I857adbd134443b17b9689c314307bb1e3888235b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2876191 Commit-Queue: Arthur Sonzogni <[email protected]> Reviewed-by: Antonio Sartori <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Cr-Commit-Position: refs/heads/master@{#880447}
…a=testonly Automatic update from web-platform-tests [Credentialless]: WPT vs CacheStorage. Add tentative WPT tests about COEP and CacheStorage. Issues: - COEP:require-corp: w3c/ServiceWorker#1490 - COEP:credentialless: w3c/ServiceWorker#1592 Bug: 1175099 Change-Id: I857adbd134443b17b9689c314307bb1e3888235b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2876191 Commit-Queue: Arthur Sonzogni <[email protected]> Reviewed-by: Antonio Sartori <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Cr-Commit-Position: refs/heads/master@{#880447} -- wpt-commits: 6bf109f244a20f48bb8723663c384e1e2220f006 wpt-pr: 28891
Add tentative WPT tests about COEP and CacheStorage. Issues: - COEP:require-corp: w3c/ServiceWorker#1490 - COEP:credentialless: w3c/ServiceWorker#1592 Bug: 1175099 Change-Id: I857adbd134443b17b9689c314307bb1e3888235b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2876191 Commit-Queue: Arthur Sonzogni <[email protected]> Reviewed-by: Antonio Sartori <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Cr-Commit-Position: refs/heads/master@{#880447} NOKEYCHECK=True GitOrigin-RevId: a07d25f92a3402c5d4b27014b353bff565873ddb
What should we do if
cache.match()
is called in a context withCross-Origin-Embedder-Policy: require-corp
and the Response to be returned does not have aCross-Origin-Resource-Policy
header?I would like to advocate that we reject the
match()
since it seems possible there could be information stored in the headers that should not be exposed to spectre attacks. Also, it seems you can have a CORS response without a CORP header that would fail the COEP check and we would not want to expose the body in that case.@mikewest @annevk @yutakahirano @makotoshimazu
The text was updated successfully, but these errors were encountered: