From 9c64c16c3e584b20f16ac0cbc393fba9f73d633a Mon Sep 17 00:00:00 2001 From: Mike West Date: Fri, 14 Feb 2020 10:06:56 +0100 Subject: [PATCH 1/3] Accept 'sec-'-prefixed headers as CORS-safelisted. As discussed in #993. --- fetch.bs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fetch.bs b/fetch.bs index 1ec576be7..03067d839 100644 --- a/fetch.bs +++ b/fetch.bs @@ -708,7 +708,11 @@ production as
  • Let value be header's value.

  • -

    Byte-lowercase header's name and switch on the result: +

    Let name be the result of byte-lowercasing header's + name. + +

  • +

    Switch on name:

    `accept` @@ -760,7 +764,12 @@ fetch("https://victim.example/naïve-endpoint", {
    Otherwise -

    Return false. +

    +

    If name does not begin with the string "sec-", return false. + +

    As all headers beginning with "Sec-" are forbidden header + names, we have some confidence that they're generated by the user agent, and not via APIs + that developers directly control.

  • If value's length is greater than 128, then return From 1bc7627ff951c515ce784ba60de9d30571fd5edb Mon Sep 17 00:00:00 2001 From: Mike West Date: Fri, 14 Feb 2020 14:30:57 +0100 Subject: [PATCH 2/3] Update fetch.bs Co-Authored-By: Anne van Kesteren --- fetch.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch.bs b/fetch.bs index 03067d839..78cadb5d7 100644 --- a/fetch.bs +++ b/fetch.bs @@ -765,7 +765,7 @@ fetch("https://victim.example/naïve-endpoint", {

    Otherwise
    -

    If name does not begin with the string "sec-", return false. +

    If name does not start with `sec-`, then return false.

    As all headers beginning with "Sec-" are forbidden header names, we have some confidence that they're generated by the user agent, and not via APIs From 4efccc0ede2258b1da53821d057e4de087200b44 Mon Sep 17 00:00:00 2001 From: Mike West Date: Fri, 14 Feb 2020 14:32:56 +0100 Subject: [PATCH 3/3] Update fetch.bs Co-Authored-By: Anne van Kesteren --- fetch.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch.bs b/fetch.bs index 78cadb5d7..f33877dc4 100644 --- a/fetch.bs +++ b/fetch.bs @@ -767,7 +767,7 @@ fetch("https://victim.example/naïve-endpoint", {

    If name does not start with `sec-`, then return false. -

    As all headers beginning with "Sec-" are forbidden header +

    As all headers starting with `Sec-` are forbidden header names, we have some confidence that they're generated by the user agent, and not via APIs that developers directly control.