Re: Cookies and schemes.

David Benjamin <davidben@chromium.org> Tue, 10 March 2020 16:29 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 376313A1317 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 10 Mar 2020 09:29:45 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.751
X-Spam-Level:
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: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=chromium.org
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hMOeOJfvVHrT for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 10 Mar 2020 09:29:42 -0700 (PDT)
Received: from lyra.w3.org (lyra.w3.org [128.30.52.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id DE4F13A12EE for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 10 Mar 2020 09:29:41 -0700 (PDT)
Received: from lists by lyra.w3.org with local (Exim 4.92) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1jBhha-0002Gi-JL for ietf-http-wg-dist@listhub.w3.org; Tue, 10 Mar 2020 16:25:54 +0000
Resent-Date: Tue, 10 Mar 2020 16:25:54 +0000
Resent-Message-Id: <E1jBhha-0002Gi-JL@lyra.w3.org>
Received: from titan.w3.org ([128.30.52.76]) by lyra.w3.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <davidben@google.com>) id 1jBhhK-0002Fq-8k for ietf-http-wg@listhub.w3.org; Tue, 10 Mar 2020 16:25:38 +0000
Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by titan.w3.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <davidben@google.com>) id 1jBhhH-00032K-MT for ietf-http-wg@w3.org; Tue, 10 Mar 2020 16:25:38 +0000
Received: by mail-pg1-x534.google.com with SMTP id c7so801235pgw.3 for <ietf-http-wg@w3.org>; Tue, 10 Mar 2020 09:25:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; 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; d=1e100.net; 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: <CAKXHy=d260V9_63yNBwLjDG=upZ+HG3iJ8hKbnFc0KU7fCbVcQ@mail.gmail.com> <110aa602-33bd-4fbf-b3af-c5530d95fc44@www.fastmail.com> <CAKXHy=cAiuxSzEFx5TJ8Uzz3mAdXk2yCmq-fi6nLAZ+LRGEoWA@mail.gmail.com> <579453b7-99cf-45cc-809c-c91f29207a1f@www.fastmail.com>
In-Reply-To: <579453b7-99cf-45cc-809c-c91f29207a1f@www.fastmail.com>
From: David Benjamin <davidben@chromium.org>
Date: Tue, 10 Mar 2020 12:25:04 -0400
Message-ID: <CAF8qwaDefAASnUPiTUEvhTydOecZiQjD6UJGxMyc3ogaA2EKmQ@mail.gmail.com>
To: Martin Thomson <mt@lowentropy.net>
Cc: HTTP Working Group <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary="000000000000033c0505a08291ee"
Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=davidben@google.com; helo=mail-pg1-x534.google.com
X-W3C-Hub-Spam-Status: No, score=-11.3
X-W3C-Hub-Spam-Report: 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: titan.w3.org 1jBhhH-00032K-MT 6f17b89da34ea077a531c234d1326ea0
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Cookies and schemes.
Archived-At: <https://www.w3.org/mid/CAF8qwaDefAASnUPiTUEvhTydOecZiQjD6UJGxMyc3ogaA2EKmQ@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/37434
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <https://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

On Tue, Mar 10, 2020 at 3:55 AM Martin Thomson <mt@lowentropy.net> 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
<https://webkit.org/blog/8146/protecting-against-hsts-abuse/>, 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
https://github.com/mikewest/strict-navigation-security.


> 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
carveout:
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
reduced.

David

[*] 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
like.