Skip to content

Commit 9c64c16

Browse files
committed
Accept 'sec-'-prefixed headers as CORS-safelisted.
As discussed in #993.
1 parent d5c3d8b commit 9c64c16

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

fetch.bs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,11 @@ production as
708708
<li><p>Let <var>value</var> be <var>header</var>'s <a for=header>value</a>.
709709

710710
<li>
711-
<p><a>Byte-lowercase</a> <var>header</var>'s <a for=header>name</a> and switch on the result:
711+
<p>Let <var>name</var> be the result of <a>byte-lowercasing</a> <var>header</var>'s
712+
<a for=header>name</a>.
713+
714+
<li>
715+
<p>Switch on <var>name</var>:
712716

713717
<dl class=switch>
714718
<dt>`<code>accept</code>`
@@ -760,7 +764,12 @@ fetch("https://victim.example/naïve-endpoint", {
760764
</div>
761765

762766
<dt>Otherwise
763-
<dd><p>Return false.
767+
<dd>
768+
<p>If <var>name</var> does not begin with the string "<code>sec-</code>", return false.
769+
770+
<p class=note>As all headers beginning with "<code>Sec-</code>" are <a>forbidden header
771+
names</a>, we have some confidence that they're generated by the user agent, and not via APIs
772+
that developers directly control.
764773
</dl>
765774

766775
<li><p>If <var>value</var>'s <a for="byte sequence">length</a> is greater than 128, then return

0 commit comments

Comments
 (0)