Re: Cookies and schemes.

David Benjamin <> Tue, 10 March 2020 16:29 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 376313A1317 for <>; Tue, 10 Mar 2020 09:29:45 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.751
X-Spam-Status: No, score=-2.751 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, HTML_MESSAGE=0.001, MAILING_LIST_MULTI=-1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: (amavisd-new); dkim=pass (1024-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id hMOeOJfvVHrT for <>; Tue, 10 Mar 2020 09:29:42 -0700 (PDT)
Received: from ( []) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by (Postfix) with ESMTPS id DE4F13A12EE for <>; Tue, 10 Mar 2020 09:29:41 -0700 (PDT)
Received: from lists by with local (Exim 4.92) (envelope-from <>) id 1jBhha-0002Gi-JL for; Tue, 10 Mar 2020 16:25:54 +0000
Resent-Date: Tue, 10 Mar 2020 16:25:54 +0000
Resent-Message-Id: <>
Received: from ([]) by with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <>) id 1jBhhK-0002Fq-8k for; Tue, 10 Mar 2020 16:25:38 +0000
Received: from ([2607:f8b0:4864:20::534]) by with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <>) id 1jBhhH-00032K-MT for; Tue, 10 Mar 2020 16:25:38 +0000
Received: by with SMTP id c7so801235pgw.3 for <>; Tue, 10 Mar 2020 09:25:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=h2JzFP7rmSTZn7g70GFA0sb1wnN3L1nIwuwHDqOgcsQ=; b=ENEwxqYc/6o7L4Q76ks1aoY1w6U/48VZp49s/daQA7Pc+NoB3ieoabLfE51wZdXoJj JCg773+Vp0JouC8MzfMkExcez7bk7XWBoYwaaxmI5cxP0hQG3IUOazw9MkJeVescSeb3 eLjHcTxiAoAWR/U3NrITd/nRTHwoENEdPO3M4=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=h2JzFP7rmSTZn7g70GFA0sb1wnN3L1nIwuwHDqOgcsQ=; b=MAleaOZNP5KXXPXg+rt66DLvHRNWBjaFKZ+lV0CibxBRQtpo7WGQhrsi+VGpaWPuA9 r5d+E6Y8gTVVRVe/kw5eTZgmBwD0meyHKxOvSBKu+STQX51EMq8ZMPdSv0cFXp8pA95V vpr6vOIRdSZI9XytHNCQ4/7Bgjecwy+7U8gGC+limOkdM+wPowkeP0oC2uvsnPab2gx1 L4VWdpju993p2Vc2tKm5uKSq8ZYHU4QjMC3/ruTPl6VLxL6JYsdTrF3gF2kGHYoknVX4 N6dzC4jrOSaXZ1RNkhlIZiH2idtgAlcG47WoWvUV8UTZzsz4HuaORqkfxyF6/3pE4ZbB 8nUA==
X-Gm-Message-State: ANhLgQ0DM7mu1NwaTpB0WhZh94Zk/1daH/btcDkTEiY3s9WFoQpeNdQF 77cJ8teZ/msbVhpKFqUad4mpwIcFoetqGKh214qP
X-Google-Smtp-Source: ADFU+vslcq4gH85N431drRgHdgH49yppcwpLr2/kvdIn/2psNtrYvYCCBq18FWnN+dBpJTNZh0t2Y9UBaGRULxjQWB8=
X-Received: by 2002:a63:e20d:: with SMTP id q13mr21208068pgh.6.1583857522621; Tue, 10 Mar 2020 09:25:22 -0700 (PDT)
MIME-Version: 1.0
References: <> <> <> <>
In-Reply-To: <>
From: David Benjamin <>
Date: Tue, 10 Mar 2020 12:25:04 -0400
Message-ID: <>
To: Martin Thomson <>
Cc: HTTP Working Group <>
Content-Type: multipart/alternative; boundary="000000000000033c0505a08291ee"
Received-SPF: pass client-ip=2607:f8b0:4864:20::534;;
X-W3C-Hub-Spam-Status: No, score=-11.3
X-W3C-Scan-Sig: 1jBhhH-00032K-MT 6f17b89da34ea077a531c234d1326ea0
Subject: Re: Cookies and schemes.
Archived-At: <>
X-Mailing-List: <> archive/latest/37434
Precedence: list
List-Id: <>
List-Help: <>
List-Post: <>
List-Unsubscribe: <>

On Tue, Mar 10, 2020 at 3:55 AM Martin Thomson <> wrote:

> On Tue, Mar 10, 2020, at 18:29, Mike West wrote:
> > 1. Perhaps we do this kind of thing only for a specific endpoint
> > (`/.well-known/migrate-nonsecure-cookies`, for example)?
> Eww.  More seriously, I can't see this fitting with existing needs very
> well.
> > 2. Perhaps we prefix the non-secure cookie names with `__Non-secure-`
> > rather than minting a new header?
> That might work.  It's new mechanisms, but not new-header-field new
> mechanisms.  More below.
> > Ideally, the load-balancing case devolves to the LB doing an immediate
> > redirect to HTTPS, and then deciding which backend the user should
> > stick to in that secure context. I don't think we should add new
> > attributes in order to support sites that push users back and forth
> > from HTTPS to HTTP.
> Yes. HSTS is the only path that has long-term legs here.  If port 80 wants
> to do some setup for port 443, that's not terrible, but ultimately I think
> we need to have servers prepared for the first connection arriving on 443.

I'm not sure if, by HSTS, you mean that sites should stick to HTTPS or if
you mean the actual HSTS header. Sites certainly should stop mixing HTTP
and HTTPS, and once they've done that, HSTS is a good thing to deploy. But
I think we should aim to make HSTS less load-bearing. Today HSTS is a
more-or-less frontline defense against all the various cookie mistakes
around partitioning HTTP and HTTPS. This is awkward because HSTS is
stateful and thus a possible tracking vector
<>, but
mitigations against that risk breaking that defense. If we can bring
cookies closer to the standard origin-based isolation in the rest of the
web, HSTS is no longer needed as a patch for cookies. The remaining use
cases (making sure you are on the correct origin to begin with, and
stricter certificate errors) primarily affect top-level navigations and are
thus more amenable to ideas like

> I'd like to understand more of why there might be multiple cleartext
> redirects involved.  Or why it might be desirable to not include cookies in
> all of those responses.
> To that end, anything we do here will apparently cause immediate bustage,
> with the possible exception of what I proposed (absent multiple redirects
> being involved).
> You might annotate those with tags that indicate their shaky status as a
> warning, but I expect that anything that isn't bustage will be roundly
> ignored.  So moving them, either by changing their name or putting them in
> a new header field, does have the effect of causing sites to pay
> attention.  But flat-out removing the cookies would also have a similar
> effect and that is the end goal.
> The only value to moving them is that maybe servers can salvage something
> from this quickly and without a ton of extra engineering.  I think that the
> prefix is the most likely to be conducive to some form of salvage, but I
> would want to hear that this is necessary and easy before we get into a
> multi-stage deprecation process.

I see two plausible reasons to want to add some kind of cross-scheme
1. as you allude to, providing a low-effort intermediate state for
(insecure) mixed-HTTP/HTTPS sites that would take longer to finish their
HTTPS migration
2. preserving state when an (insecure) fully-HTTP site migrates to HTTPS

On (1), the intermediate state is added fuss because the affected sites
which take advantage of it still need to do the work to migrate to HTTPS.
It also is a risk that we'll be stuck in that intermediate state. Thus I
think it is only valuable if we can get to the intermediate state faster
and the intermediate state is useful in itself. For it to be useful, I
think it needs to be robust against attackers. I'm thus not excited about
anything which keys on redirects because redirects can be faked by the
network. Today, cookies are insecure by default and opt-in secure (if you
use both the Secure attribute and the __Secure- prefix). I think a good
intermediate state would be secure by default and opt-out secure (whether
we spell the opt-out __Non-secure- or Sec-Nonsecure-Cookie or whatever is I
think mostly about the "low-effort" goal, as long as it actually
functions[*] as an opt-out). Then after sufficient time has passed to
reasonably expect a full HTTPS migration, we remove that opt-out, meeting
standard security requirements of the web platform. (Or rather something
closer to it. We'd still have port and eTLD+1 silliness.)

On (2), the thinking would be that sites shouldn't be disincentivized from
migrating from HTTP to HTTPS out of worry of losing all their state. Such a
site might then use the above opt-in path as a one-time migration and then
stop consuming the insecure values after the migration is done. Of course,
they'll do the former but never do the latter, which is why this can't be
there forever. The question then is when would we be okay removing this. I
think that's where the cookie lifetime change fits in. Given that http://
is pronounced "the network", it is not a suitable scope for long-term
state, thus it makes sense to tie the lifetime to some notion of
session—just long enough that the user can still perform continuous actions
to avoid breaking everything. If that sticks, there won't be meaningful
state to migrate to HTTPS in the first place and the need for (2) is


[*] An example of something which doesn't actually function as an opt-out
would be an Insecure attribute to mirror the existing Secure attribute.
That helps with HTTPS-to-HTTP leaks but it provides no defense against
HTTP-to-HTTPS injection because the network can add that attribute all they