diff --git a/fetch.bs b/fetch.bs index 016dc95cc..6dd75f6a7 100644 --- a/fetch.bs +++ b/fetch.bs @@ -1751,14 +1751,17 @@ source of security bugs. Please seek security review for features that deal with
To serialize a request URL for reporting, given a request -request, run these steps: +
To serialize a response URL for reporting, given a response +response, run these steps:
Assert: response's URL list is not empty. +
Let url be a copy of request's URL. +
Let url be a copy of response's URL list's first + element. -
This is not request's current URL in order to avoid +
This is not response's URL in order to avoid
leaking information about redirect targets (see
similar considerations for CSP reporting
too). [[CSP]]
@@ -3147,23 +3150,56 @@ response header can be used to require checking a request<
Cross-Origin-Resource-Policy = %s"same-origin" / %s"same-site" / %s"cross-origin" ; case-sensitive
- To perform a cross-origin resource policy check, given a request and
-response, run these steps: To perform a cross-origin resource policy check, given an origin
+origin, an environment settings object settingsObject, a
+response response, and an optional boolean forNavigation, run
+these steps:
If request's mode is not " Set forNavigation to false if it is not given.
+
+ Let embedderPolicy be settingsObject's
+ embedder policy.
If request's origin is same origin with
- request's current URL's origin, then return
- allowed.
+ If the cross-origin resource policy internal check with origin,
+ " While redirects that carry a
- ` This step is needed because we don't want to report violations not related to
+ Cross-Origin Embedder Policy below.
+
+ If the cross-origin resource policy internal check with origin,
+ embedderPolicy's report only value, response,
+ and forNavigation returns blocked, then
+ queue a cross-origin embedder policy CORP violation report with response,
+ settingsObject, and true.
+
+ If the cross-origin resource policy internal check with origin,
+ embedderPolicy's value, response, and
+ forNavigation returns allowed, then return allowed.
+
+ Queue a cross-origin embedder policy CORP violation report with response,
+ settingsObject, and false.
+
+ Return blocked.
+ Only HTML's navigate algorithm uses this check with
+forNavigation set to true, and it's always for nested navigations. Otherwise,
+response is either the internal response of an
+opaque filtered response or a response which will be the
+internal response of an
+opaque filtered response. [[HTML]]
+
+ To perform a cross-origin resource policy internal check, given an
+origin origin, an embedder policy value
+embedderPolicyValue, a response response, and a boolean
+forNavigation, run these steps:
+
+ If forNavigation is true and embedderPolicyValue is
+ " Let policy be the result of getting
@@ -3171,31 +3207,93 @@ Cross-Origin-Resource-Policy = %s"same-origin" / %s"same-site" / %s"cross-or
header list.
This means that ` If policy is neither ` If policy is ` If policy is null and embedderPolicyValue is
+ " If the following are true
+ Switch on policy:
- Return allowed.
- then return allowed.
+ If origin is same origin with response's URL's
+ origin, then return allowed.
- This prevents HTTPS responses with
- ` Otherwise, return blocked.
- If policy is ` If the following are true
- Return allowed.
+ origin is schemelessly same site with response's
+ URL's origin
+
+ origin's scheme is " then return allowed.
+
+ Otherwise, return blocked.
+
+ ` To queue a cross-origin embedder policy CORP violation report, given a
+response response, an environment settings object
+settingsObject, and a boolean reportOnly, run these steps:
+
+ Let endpoint be settingsObject's
+ embedder policy's
+ report only reporting endpoint if reportOnly is true and
+ settingsObject's embedder policy's
+ reporting endpoint otherwise.
+
+ Let serialized url be the result of
+ serializing a response URL for reporting with
+ response.
+
+ Let body be a new object containing the following properties:
+
+ Queue body as the " If internalResponse's URL list is empty, then
set it to a clone of request's URL list.
- A response's URL list will typically be empty at
- this point, unless it came from a service worker, in which case it will only be empty if it was
- created through A response's URL list can be empty (for example,
+ when the response represents an
-
+
+no-cors
", then return
- allowed.
+ unsafe-none
", response, and
+ forNavigation returns blocked, then return blocked.
- Cross-Origin-Resource-Policy
` header are checked, redirects
- without such a header resulting in response do not affect the outcome as the default is
- allowed.
-
+
+
+
+unsafe-none
", then return allowed.
Cross-Origin-Resource-Policy: same-site, same-origin
`
- ends up as allowed below as it will never match anything. Two or more
- `Cross-Origin-Resource-Policy
` headers will have the same effect.
+ ends up as allowed below as it will never match anything, as long as
+ embedderPolicyValue is "unsafe-none
".
+ Two or more `Cross-Origin-Resource-Policy
` headers will have the
+ same effect.
+
+ same-origin
`, `same-site
`, nor
+ `cross-origin
`, then set policy to null.
- same-origin
`, then return blocked.
+ require-corp
", then set policy to
+ `same-origin
`.
-
+ https
" or response's HTTPS state is
- "none
"
-
+
+cross-origin
`
+ same-origin
`
+ Cross-Origin-Resource-Policy: same-site
` from being accessed without secure
- transport.
+ same-site
`, then return blocked.
+ same-site
`
+
+
+
+ https
" or
+ response's HTTPS state is "none
"
+ Cross-Origin-Resource-Policy: same-site
` does not consider a
+ response delivered via a secure transport to match a non-secure requesting origin,
+ even if their hosts are otherwise same site. Securely-transported responses will only
+ match a securely-transported initiator.
+
+
@@ -3589,9 +3687,8 @@ optionally with a recursive flag, run these steps:
+
+
+
+ key
+ value
+
+
+
+
+ " type
"
+ " corp
"
+
+
+
+ " blocked-url
"
+ serialized url
+ coep
" report type for
+ endpoint on settingsObject. [[!REPORTING]]
new Response()
.
+ about
URL).
@@ -3961,6 +4058,18 @@ optional CORS-preflight flag, run these steps:
then set request's timing allow failed flag.
If either request's response tainting or response's
+ type is "opaque
", and the
+ cross-origin resource policy check with request's origin,
+ request's client, and actualResponse returns
+ blocked, then return a network error.
+
+
The cross-origin resource policy check runs for responses coming from the + network and responses coming from the service worker. This is different from the + CORS check, as request's client and the service worker can + have different embedder policies. +
If actualResponse's status is a redirect status, then: @@ -4513,13 +4622,12 @@ Range Requests. [[HTTP-RANGE]] However, this is not widely supported by b +
Set response's URL list to a clone of + httpRequest's URL list. +
If httpRequest's header list contains
`Range
`, then set response's range-requested flag.
-
If httpRequest's response tainting is not "cors
"
- and the cross-origin resource policy check with request and response
- returns blocked, then return a network error.
-
If response's status is 401
,
httpRequest's response tainting is not "cors
", the