@@ -3143,58 +3143,144 @@ response <a for=/>header</a> can be used to require checking a <a for=/>request<
3143
3143
Cross-Origin-Resource-Policy = %s"same-origin" / %s"same-site" / %s"cross-origin" ; case-sensitive
3144
3144
</code></pre>
3145
3145
3146
- <p> To perform a <dfn>cross-origin resource policy check</dfn> , given a <var> request</var> and
3147
- <var> response</var> , run these steps:</p>
3146
+ <p> To perform a <dfn>cross-origin resource policy internal check</dfn> , given a string
3147
+ <var> embedder policy value</var> , a <a for=/>request</a> <var> request</var> and
3148
+ a <a for=/>response</a> <var> response</var> , run these steps:</p>
3148
3149
3149
3150
<ol>
3150
- <li><p> If <var> request</var> 's <a for=request>mode</a> is not "<code> no-cors </code> ", then return
3151
- <b> allowed </b> .
3151
+ <li><p> Assert: <var> request</var> 's <a for=request>mode</a> is "<code> navigate </code> " or
3152
+ " <code> no-cors </code> " .
3152
3153
3153
3154
<li>
3154
- <p> If <var> request</var> 's <a for=request>origin</a> is <a>same origin</a> with
3155
- <var> request</var> 's <a for=request>current URL</a>' s <a for=url>origin</a> , then return
3156
- <b> allowed</b> .
3155
+ <p> If <var> request</var> 's <a for=request>mode</a> is "<code> navigate</code> ":
3157
3156
3158
- <p class="note no-backref"> While redirects that carry a
3159
- `<a http-header><code>Cross-Origin-Resource-Policy</code></a> ` header are checked, redirects
3160
- without such a header resulting in <var> response</var> do not affect the outcome as the default is
3161
- <b> allowed</b> .
3162
- <!-- This changes with COEP's cross-origin value. -->
3157
+ <p class="note no-backref"> Only HTML's navigate algorithm uses this check for the
3158
+ "<code> navigate</code> " <a for=request>mode</a> , for nested navigations. [[!HTML]]
3159
+
3160
+ <ol>
3161
+ <li>
3162
+ <p> Assert: <var> request</var> is for a nested navigation.
3163
+
3164
+ <p class=XXX> Fix this assertion when
3165
+ <a href="https://github.com/whatwg/fetch/pull/948">#948</a> is merged.
3166
+
3167
+ <li><p> If <var> embedder policy value</var> is "<code> unsafe-none</code> ", then return
3168
+ <b> allowed</b> .
3169
+ </ol>
3163
3170
3164
3171
<li>
3165
3172
<p> Let <var> policy</var> be the result of <a for="header list">getting</a>
3166
3173
`<a http-header><code>Cross-Origin-Resource-Policy</code></a> ` from <var> response</var> 's
3167
3174
<a for=response>header list</a> .
3168
3175
3169
3176
<p class=note> This means that `<code> Cross-Origin-Resource-Policy: same-site, same-origin</code> `
3170
- ends up as <b> allowed</b> below as it will never match anything. Two or more
3177
+ ends up as <b> allowed</b> below as it will never match anything, as long as
3178
+ <var> embedder policy value</var> is "<code> unsafe-none</code> ". Two or more
3171
3179
`<a http-header><code>Cross-Origin-Resource-Policy</code></a> ` headers will have the same effect.
3172
3180
3173
- <li><p> If <var> policy</var> is `<code> same-origin</code> `, then return <b> blocked</b> .
3181
+ <li><p> If <var> policy</var> is null and <var> embedder policy value</var> is
3182
+ "<code> require-corp</code> ", then set <var> policy</var> to "<code> same-origin</code> ".
3174
3183
3175
3184
<li>
3176
- <p> If the following are true
3185
+ <p> Switch on <var> policy </var> :
3177
3186
3178
- <ul class=brief>
3179
- <li><var> request</var> 's <a for=request>origin</a> is <a>schemelessly same site</a> with
3180
- <var> request</var> 's <a for=request>current URL</a>' s <a for=url>origin</a>
3181
- <li><var> request</var> 's <a for=request>origin</a>' s <a for=url>scheme</a> is
3182
- "<code> https</code> " or <var> response</var> 's <a for=response>HTTPS state</a> is
3183
- "<code> none</code> "
3184
- </ul>
3187
+ <dl class=switch>
3188
+ <dt> null
3189
+ <dt> "<code> cross-origin</code> "
3190
+ <dd><p> Return <b> allowed</b> .
3185
3191
3186
- <p> then return <b> allowed</b> .
3192
+ <dt> "<code> same-origin</code> "
3193
+ <dd>
3194
+ <p> If <var> request</var> 's <a for=request>origin</a> is <a>same origin</a> with
3195
+ <var> request</var> 's <a for=request>current URL</a>' s <a for=url>origin</a> , then return
3196
+ <b> allowed</b> .
3187
3197
3188
- <p class=note> This prevents HTTPS responses with
3189
- `<code> Cross-Origin-Resource-Policy: same-site</code> ` from being accessed without secure
3190
- transport.
3198
+ <p> Otherwise, return <b> blocked</b> .
3191
3199
3192
- <li><p> If <var> policy</var> is `<code> same-site</code> `, then return <b> blocked</b> .
3200
+ <dt> "<code> same-site</code> "
3201
+ <dd>
3202
+ <p> If the following are true
3193
3203
3194
- <li><p> Return <b> allowed</b> .
3204
+ <ul class=brief>
3205
+ <li><p><var> request</var> 's <a for=request>origin</a> is <a>schemelessly same site</a> with
3206
+ <var> request</var> 's <a for=request>current URL</a>' s <a for=url>origin</a>
3207
+
3208
+ <li><p><var> request</var> 's <a for=request>origin</a>' s <a for=url>scheme</a> is
3209
+ "<code> https</code> " or <var> response</var> 's <a for=response>HTTPS state</a> is
3210
+ "<code> none</code> "
3211
+ </ul>
3212
+
3213
+ <p> then return <b> allowed</b> .
3214
+
3215
+ <p> Otherwise, return <b> blocked</b> .
3216
+
3217
+ <p class=note> `<code> Cross-Origin-Resource-Policy: same-site</code> ` does not consider a
3218
+ response delivered via a secure transport to match a non-secure requesting origin,
3219
+ even if their hosts are otherwise same site. Securely-transported responses will only
3220
+ match a securely-transported initiator.
3221
+ </dl>
3222
+ </ol>
3223
+
3224
+ <p> To <dfn>queue a cross-origin embedder policy CORP violation report</dfn> , given a <a for=/>request</a>
3225
+ <var> request</var> and a string <var> reporting endpoint</var> , run these steps:
3226
+
3227
+ <ol>
3228
+ <li><p> Let <var> serialized url</var> be the result of
3229
+ <a lt="serialize a request URL for reporting">serializing a request URL for reporting</a> with
3230
+ <var> request</var> .
3231
+
3232
+ <li>
3233
+ <p> Let <var> body</var> be a new object containing the following properties:
3234
+
3235
+ <table>
3236
+ <thead>
3237
+ <th> key
3238
+ <th> value
3239
+ </thead>
3240
+ <tbody>
3241
+ <tr>
3242
+ <td> "<code> type</code> "
3243
+ <td> "<code> corp</code> "
3244
+ </tr>
3245
+ <tr>
3246
+ <td> "<code> blocked-url</code> "
3247
+ <td><var> serialized url</var>
3248
+ </tr>
3249
+ </tbody>
3250
+ </table>
3251
+
3252
+ <li><p> <a href="https://w3c.github.io/reporting/#queue-report">Queue</a> <var> body</var> as
3253
+ "<code> coep</code> " for <var> reporting endpoint</var> on <var> request</var> 's
3254
+ <a for=request>client</a> . [[!REPORTING]]
3195
3255
</ol>
3196
3256
3197
3257
3258
+ <p> To perform a <dfn>cross-origin resource policy check</dfn> , given a <a for=/>request</a>
3259
+ <var> request</var> and a <a for=/>response</a> <var> response</var> , run these steps:</p>
3260
+ <ol>
3261
+ <li><p> Let <var> embedder policy</var> be <var> request</var> 's <a for=request>client</a>' s
3262
+ embedder policy.
3263
+
3264
+ <li>
3265
+ <p> If the <a>cross-origin resource policy internal check</a> with "<code> unsafe-none</code> ",
3266
+ <var> request</var> and <var> response</var> returns <b> blocked</b> , then return <b> blocked</b> .
3267
+
3268
+ <p class="note no-backref"> This is to queue only COEP related violation reports.
3269
+
3270
+ <li><p> If the <a>cross-origin resource policy internal check</a> with <var> embedder policy</var> 's
3271
+ report only value, <var> request</var> and <var> response</var> returns <b> blocked</b> , then
3272
+ <a>queue a cross-origin embedder policy CORP violation report</a> with
3273
+ <var> request</var> and <var> embedder policy</var> 's report only reporting endpoint.
3274
+
3275
+ <li><p> If the <a>cross-origin resource policy internal check</a> with
3276
+ <var> embedder policy</var> 's value, <var> request</var> and <var> response</var> returns
3277
+ <b> allowed</b> , then return <b> allowed</b> .
3278
+
3279
+ <li><p> <a>Queue a cross-origin embedder policy CORP violation report</a> with <var> request</var>
3280
+ and <var> embedder policy</var> 's reporting endpoint.
3281
+
3282
+ <li><p> Return <b> blocked</b> .
3283
+ </ol>
3198
3284
3199
3285
<h2 id=fetching>Fetching</h2>
3200
3286
@@ -3891,6 +3977,10 @@ optional <i>CORS-preflight flag</i>, run these steps:
3891
3977
3892
3978
<li><var> request</var> 's <a for=request>redirect mode</a> is not "<code> follow</code> " and
3893
3979
<var> response</var> 's <a for=response>URL list</a> has more than one item.
3980
+
3981
+ <li><p><var> request</var> 's <a for=request>response tainting</a> is "<code> opaque</code> " and
3982
+ the <a>cross-origin resource policy check</a> with <var> request</var> and <var> response</var>
3983
+ returns <b> blocked</b> .
3894
3984
</ul>
3895
3985
3896
3986
<p> then return a <a>network error</a> .
@@ -4511,7 +4601,7 @@ Range Requests</cite>. [[HTTP-RANGE]] However, this is not widely supported by b
4511
4601
<li><p> If <var> httpRequest</var> 's <a for=request>header list</a> <a for="header list">contains</a>
4512
4602
`<code> Range</code> `, then set <var> response</var> 's <a for=response>range-requested flag</a> .
4513
4603
4514
- <li><p> If <var> httpRequest</var> 's <a for=request>response tainting</a> is not "<code> cors </code> "
4604
+ <li><p> If <var> httpRequest</var> 's <a for=request>response tainting</a> is "<code> opaque </code> "
4515
4605
and the <a>cross-origin resource policy check</a> with <var> request</var> and <var> response</var>
4516
4606
returns <b> blocked</b> , then return a <a>network error</a> .
4517
4607
0 commit comments