Skip to content

Commit a75942e

Browse files
committed
Disallow CORS-safelisted Content-Type headers.
This prevents e.g. websites creating forms that can start a local WebDriver session in a browser, even if there's no Origin header
1 parent 045f7bc commit a75942e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

index.html

+16
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,10 @@ <h3>Processing model</h3>
440440
let <var>origin</var> be the value of that header. Otherwise
441441
let <var>origin</var> be undefined.</p></li>
442442

443+
<li><p><p>If <var>request</var> has an <a>Content-Type header</a>,
444+
let <var>content-type</var> be the value of that header. Otherwise
445+
let <var>content-type</var> be undefined.</p></li>
446+
443447
<li><p>If any of the following conditions hold:
444448
<ul>
445449
<li><p><var>host</var> is undefined.</p></li>
@@ -476,6 +480,18 @@ <h3>Processing model</h3>
476480
the <a>Origin header</a> is necessary to prevent untrusted websites
477481
from establishing a WebDriver session.</p></li>
478482

483+
<li><p>If <var>content-type</var> is not undefined, and
484+
("<code>content-type</code>", <var>content-type</var>) is a
485+
[=CORS-safelisted request-header=], or otherwise if the value
486+
of <var>content-type</var> is not a <a>Content-Type header</a> the
487+
implementation allows, then stop running these steps and act as if
488+
the requested service is not available.</p>
489+
490+
<p class=note>This provides an additional layer of defence against
491+
requests originating from untrusted websites. Implementations can
492+
choose to implement this by only accepting requests with the
493+
"<code>application/json</code>" Content-Type header.</p></li>
494+
479495
<li><p>Let <var>request match</var> be the result of the algorithm
480496
to <a>match a request</a> with <var>request</var>’s
481497
<a>method</a> and <a>URL</a> as arguments.

0 commit comments

Comments
 (0)