Skip to content

Commit a18fb3e

Browse files
authored
Do not CORS-safelist a Range header without a start
As per #1450 the intent was never to allow this. The algorithm before #1454 would yield undefined behavior for this input, but after it incorrectly ended up being allowed. This change makes it clearly disallowed. Already tested in WPT cors/cors-safelisted-request-header.any.js.
1 parent 283c2ae commit a18fb3e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

fetch.bs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,19 @@ fetch("https://victim.example/naïve-endpoint", {
923923
</div>
924924

925925
<dt>`<code>range</code>`
926-
<dd><p>If the result of <a>parse a single range header value</a> given <var>value</var> is
927-
failure, then return false.
926+
<dd>
927+
<ol>
928+
<li><p>Let <var>rangeValue</var> be the result of <a>parsing a single range header value</a>
929+
given <var>value</var>.
930+
931+
<li><p>If <var>rangeValue</var> is failure, then return false.
932+
933+
<li>
934+
<p>If <var>rangeValue</var>[0] is null, then return false.
935+
936+
<p class=note>As web browsers have historically not emitted ranges such as
937+
`<code>bytes=-500</code>` this algorithm does not safelist them.
938+
</ol>
928939

929940
<dt>Otherwise
930941
<dd><p>Return false.

0 commit comments

Comments
 (0)