Skip to content

Commit 0613515

Browse files
Specify the behavior of COEP: credentialless
This complements this HTML PR: whatwg/html#6638.
1 parent 09acae8 commit 0613515

File tree

1 file changed

+54
-6
lines changed

1 file changed

+54
-6
lines changed

fetch.bs

+54-6
Original file line numberDiff line numberDiff line change
@@ -1937,6 +1937,27 @@ source of security bugs. Please seek security review for features that deal with
19371937
<a for="URL serializer"><i>exclude fragment</i></a> set to true.
19381938
</ol>
19391939

1940+
<p>To check if <dfn export>Cross-Origin-Embedder-Policy allows credentials</dfn>, given a
1941+
<a for=/>request</a> <var>request</var>, run these steps:
1942+
1943+
<ol>
1944+
<li><p>If <var>request</var>'s <a for=request>mode</a> is not "<code>no-cors</code>", then return
1945+
true.</p>
1946+
1947+
<li><p>If <var>request</var>'s <a for=request>client</a> is null, then return true.</p>
1948+
1949+
<li><p>If <var>request</var>'s <a for=request>client</a>'s
1950+
<a for="environment settings object">policy container</a>'s
1951+
<a for="policy container">embedder policy</a>'s <a for="embedder policy">value</a> is not
1952+
"<a for="embedder policy value"><code>credentialless</code></a>", then return true.</p>
1953+
1954+
<li><p>If <var>request</var>'s <a for=request>origin</a> is <a>same origin</a> with
1955+
<var>request</var>'s <a for=request>current URL</a>'s <a for=url>origin</a> and
1956+
<var>request</var>'s <a for=request>tainted origin flag</a> is not set, then return true.</p>
1957+
1958+
<li><p>Return false.</p>
1959+
</ol>
1960+
19401961

19411962
<h4 id=responses>Responses</h4>
19421963

@@ -2023,6 +2044,9 @@ initially unset.
20232044
being provided to an API that didn't make a range request. See the flag's usage for a detailed
20242045
description of the attack.
20252046

2047+
<p>A <a for=/>response</a> has an associated <dfn for=response>request-includes-credentials</dfn>
2048+
(a boolean), which is initially true.
2049+
20262050
<p>A <a for=/>response</a> has an associated
20272051
<dfn for=response id=concept-response-timing-allow-passed>timing allow passed flag</dfn>, which is
20282052
initially unset.
@@ -3524,7 +3548,7 @@ Cross-Origin-Resource-Policy = %s"same-origin" / %s"same-site" / %s"cross-or
35243548

35253549
<li>
35263550
<p>If the <a>cross-origin resource policy internal check</a> with <var>origin</var>,
3527-
"<code><a for="embedder policy value">unsafe-none</a></code>", <var>response</var>, and
3551+
"<a for="embedder policy value"><code>unsafe-none</code></a>", <var>response</var>, and
35283552
<var>forNavigation</var> returns <b>blocked</b>, then return <b>blocked</b>.
35293553

35303554
<p class="note">This step is needed because we don't want to report violations not related to
@@ -3559,7 +3583,7 @@ Cross-Origin-Resource-Policy = %s"same-origin" / %s"same-site" / %s"cross-or
35593583

35603584
<ol>
35613585
<li><p>If <var>forNavigation</var> is true and <var>embedderPolicyValue</var> is
3562-
"<code><a for="embedder policy value">unsafe-none</a></code>", then return <b>allowed</b>.
3586+
"<a for="embedder policy value"><code>unsafe-none</code></a>", then return <b>allowed</b>.
35633587

35643588
<li>
35653589
<p>Let <var>policy</var> be the result of <a for="header list">getting</a>
@@ -3568,16 +3592,33 @@ Cross-Origin-Resource-Policy = %s"same-origin" / %s"same-site" / %s"cross-or
35683592

35693593
<p class=note>This means that `<code>Cross-Origin-Resource-Policy: same-site, same-origin</code>`
35703594
ends up as <b>allowed</b> below as it will never match anything, as long as
3571-
<var>embedderPolicyValue</var> is "<code><a for="embedder policy value">unsafe-none</a></code>".
3595+
<var>embedderPolicyValue</var> is "<a for="embedder policy value"><code>unsafe-none</code></a>".
35723596
Two or more `<a http-header><code>Cross-Origin-Resource-Policy</code></a>` headers will have the
35733597
same effect.
35743598

35753599
<li><p>If <var>policy</var> is neither `<code>same-origin</code>`, `<code>same-site</code>`, nor
35763600
`<code>cross-origin</code>`, then set <var>policy</var> to null.
35773601

3578-
<li><p>If <var>policy</var> is null and <var>embedderPolicyValue</var> is
3579-
"<code><a for="embedder policy value">require-corp</a></code>", then set <var>policy</var> to
3580-
`<code>same-origin</code>`.
3602+
<li>
3603+
<p>If <var>policy</var> is null, then switch on <var>embedderPolicyValue</var>:</p>
3604+
3605+
<dl class=switch>
3606+
<dt>"<a for="embedder policy value"><code>unsafe-none</code></a>"
3607+
<dd><p>Do nothing.
3608+
3609+
<dt>"<a for="embedder policy value"><code>credentialless</code></a>"
3610+
<dd>
3611+
<p>Set <var>policy</var> to `<code>same-origin</code>` if:
3612+
3613+
<ul>
3614+
<li><var>response</var>'s <a for="response">request-includes-credentials</a> is true, or
3615+
<li><var>forNavigation</var> is true.
3616+
</ul>
3617+
3618+
<dt>"<a for="embedder policy value"><code>require-corp</code></a>"
3619+
<dd><p>Set <var>policy</var> to `<code>same-origin</code>`.
3620+
</dl>
3621+
</li>
35813622

35823623
<li>
35833624
<p>Switch on <var>policy</var>:
@@ -4729,6 +4770,9 @@ steps. They return a <a for=/>response</a>.
47294770

47304771
<p>is true; otherwise false.
47314772

4773+
<li><p>If <a>Cross-Origin-Embedder-Policy allows credentials</a> with <var>request</var> returns
4774+
false, then set <var>includeCredentials</var> to false.
4775+
47324776
<li><p>Let <var>contentLength</var> be <var>httpRequest</var>'s <a for=request>body</a>'s
47334777
<a for=body>length</a>, if <var>httpRequest</var>'s <a for=request>body</a> is non-null;
47344778
otherwise null.
@@ -5095,6 +5139,9 @@ steps. They return a <a for=/>response</a>.
50955139
<li><p>If <var>httpRequest</var>'s <a for=request>header list</a> <a for="header list">contains</a>
50965140
`<code>Range</code>`, then set <var>response</var>'s <a for=response>range-requested flag</a>.
50975141

5142+
<li><p>Set <var>response</var>'s <a for=response>request-includes-credentials</a> to
5143+
<var>includeCredentials</var>.
5144+
50985145
<li>
50995146
<p>If <var>response</var>'s <a for=response>status</a> is 401, <var>httpRequest</var>'s
51005147
<a for=request>response tainting</a> is not "<code>cors</code>", <var>includeCredentials</var> is
@@ -7959,6 +8006,7 @@ Arkadiusz Michalski,
79598006
Arne Johannessen,
79608007
Artem Skoretskiy,
79618008
Arthur Barstow,
8009+
Arthur Sonzogni, <!-- ArthurSonzogni; GitHub -->
79628010
Asanka Herath,
79638011
Axel Rauschmayer,
79648012
Ben Kelly,

0 commit comments

Comments
 (0)