Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Explicitly perform a CORP check in service worker #3

Merged
merged 3 commits into from
Dec 16, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,6 @@ to incoming responses. To do so, Fetch is patched as follows:
2. The [$cross-origin resource policy check$] is rewritten to take the [=/embedder policy=] into
account, and to cover some [=navigation requests=] in addition to `no-cors` requests.

3. ISSUE: The [$cross-origin resource policy check$] needs to be performed _after_ the relevant
service worker has the opportunity to respond to a request, as it may otherwise be allowed to
respond to a `require-corp` [=request/client=] with an opaque response which doesn't assert
CORP.

### Cross-Origin Resource Policy Checks ### {#corp-check}

To perform a <dfn abstract-op>cross-origin resource policy check</dfn> given a [=request=]
Expand Down Expand Up @@ -422,6 +417,21 @@ To perform a <dfn abstract-op>cross-origin resource policy check</dfn> given a [
extensions, and I think it'll be more difficult to ship them after inverting the
error-handling behavior.

Integration with Service Worker {#integration-sw}
-------------------------------------------------

In https://w3c.github.io/ServiceWorker/#dom-fetchevent-respondwith, replace 10.1 with the following
item.

1. If |response| is not a `Response` object, or the result of performing a
[$cross-origin resource policy check$] with _event_'s request's associated request and _response_'s
associated response is `blocked`, then set the respond-with-error flag.

Also add the following note.

The [$cross-origin resource policy check$] needs to be performed _after_ the relevant service
yutakahirano marked this conversation as resolved.
Show resolved Hide resolved
worker has the opportunity to respond to a request, as it may otherwise be allowed to respond to a
`require-corp` [=request/client=] with an opaque response which doesn't assert CORP.

Implementation Considerations {#impl-considerations}
====================================================
Expand Down