Re: Harmonizing draft-west-cookie-prefixes-05 with the web origin concept

"Emily Stark (Dunn)" <estark@google.com> Fri, 19 February 2016 23:05 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 (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 487CD1B35EC for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 19 Feb 2016 15:05:29 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.385
X-Spam-Level:
X-Spam-Status: No, score=-6.385 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RP_MATCHES_RCVD=-0.006, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham
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 mgbRhnENB-zB for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 19 Feb 2016 15:05:26 -0800 (PST)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id C637C1B35EA for <httpbisa-archive-bis2Juki@lists.ietf.org>; Fri, 19 Feb 2016 15:05:25 -0800 (PST)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1aWu30-0004sR-Np for ietf-http-wg-dist@listhub.w3.org; Fri, 19 Feb 2016 23:01:14 +0000
Resent-Date: Fri, 19 Feb 2016 23:01:14 +0000
Resent-Message-Id: <E1aWu30-0004sR-Np@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <estark@google.com>) id 1aWu2t-0004rV-QD for ietf-http-wg@listhub.w3.org; Fri, 19 Feb 2016 23:01:07 +0000
Received: from mail-io0-f176.google.com ([209.85.223.176]) by maggie.w3.org with esmtps (TLS1.2:RSA_ARCFOUR_SHA1:128) (Exim 4.80) (envelope-from <estark@google.com>) id 1aWu2q-0006fA-FA for ietf-http-wg@w3.org; Fri, 19 Feb 2016 23:01:07 +0000
Received: by mail-io0-f176.google.com with SMTP id z135so125464179iof.0 for <ietf-http-wg@w3.org>; Fri, 19 Feb 2016 15:00:43 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=4Hl0zuvRIedNpGtPl01XmnMPeTt27bHdSGq801K9WCA=; b=TohGU6UffpDZJRZp0qyGOR5hJFZ4hl/foNL1rS+ErHzEnmsYRKFRm4RnU/2NqFOrDV IRMIYLuU1hQtfQGGpElZiH0+sTomRWXWxxMWNdAcJx//DkV47rUPV7K2/7NGyNDAc73A tD8U8ISB/LdI4S7ZKk2eDDiYf8GXkYezPixbwkKhw8+W37LMKmE+EgF7aLmDqhLR/FCH XEDQxWvvLLP5eBkDNqDYOE0gFVGw7/HaSpDeKpGYxwa8/Ly0r1WTVrtfU9xXq9nQ3r9o sL/UeF184O/SE0gtet84eqQrgwX3Y8Q3Axywz13K/alFcLXvqVy2yZ6eOp3jac9Mj/aU PBBg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=4Hl0zuvRIedNpGtPl01XmnMPeTt27bHdSGq801K9WCA=; b=Ow+TTK81p/nSH4OArNBG+CY0ekdSMY/ge6mfhNfhxepEU8R2RJp9VDSf+gu/DluaKI A7aIUqXrqr6nXC6qjt1a8Liy78LhVcg3KI3fYXTY9WOhhjfHwpI+R+F/pctDZbyVvWvO tZ/U3L962rzYm5ejAEG0mIx/U0H3i3Ql07gr3DuYuYw7MfL97I/Ka8hAi27BkMUo66uH DXAnajwiOkq3NkeiPiRgoF6Lf0cWZpL6cqTigPYJ5tXnypujj3JUSEI96HJA7eDSrXwm IRZg5Kpd5Sm8U/x/X6YEGol6GshIFpd77GH6Ik/eATtLF8srF6eniKpxi3b9dtNfiz2e OcpQ==
X-Gm-Message-State: AG10YOTyCgqmW++Z7YnseoxphcEv3Z1mFJDl/JB1RBI6IwL1i6KHoi1h7LcfAHntKCPMIP704DNf/4I27T7BmAkP
X-Received: by 10.107.36.80 with SMTP id k77mr9500620iok.121.1455922837836; Fri, 19 Feb 2016 15:00:37 -0800 (PST)
MIME-Version: 1.0
Received: by 10.50.225.71 with HTTP; Fri, 19 Feb 2016 15:00:18 -0800 (PST)
In-Reply-To: <CAKXHy=d6qUUr4iW9fMFrWo4OMGjMCp+ttC96afiXhPY2UOZitw@mail.gmail.com>
References: <CADBiRd373aPUXeZ+6ZrYM1273H3-AVDSpLJxXLMUaj9Nvixypg@mail.gmail.com> <CAKXHy=d6qUUr4iW9fMFrWo4OMGjMCp+ttC96afiXhPY2UOZitw@mail.gmail.com>
From: "Emily Stark (Dunn)" <estark@google.com>
Date: Fri, 19 Feb 2016 15:00:18 -0800
Message-ID: <CAPP_2SaJkJx5UTBdxtfA_9fznyeJBBWGvEq+QmiG9XtxoeM7RA@mail.gmail.com>
To: Mike West <mkwst@google.com>
Cc: Adam Barth <w3c@adambarth.com>, httpbis <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary="001a1141909e922d46052c277373"
Received-SPF: pass client-ip=209.85.223.176; envelope-from=estark@google.com; helo=mail-io0-f176.google.com
X-W3C-Hub-Spam-Status: No, score=-5.3
X-W3C-Hub-Spam-Report: AWL=0.360, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RP_MATCHES_RCVD=-0.006, SPF_PASS=-0.001, W3C_AA=-1, W3C_DB=-1, W3C_WL=-1
X-W3C-Scan-Sig: maggie.w3.org 1aWu2q-0006fA-FA d27397369e8bd288b6606950be014633
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Harmonizing draft-west-cookie-prefixes-05 with the web origin concept
Archived-At: <http://www.w3.org/mid/CAPP_2SaJkJx5UTBdxtfA_9fznyeJBBWGvEq+QmiG9XtxoeM7RA@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/31078
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: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

On Thu, Jan 7, 2016 at 7:36 AM, Mike West <mkwst@google.com> wrote:

> Thanks for your feedback, Adam. This is helpful. CCing Emily, who has put
> together the implementation in Chrome that we're hoping to ship shortly.
>
> Before diving into the issues and suggestions, I'd like to back up just a
> moment: One of the things I like about the prefix proposal in
> draft-west-cookie-prefixes is that it doesn't actually introduce anything
> new. The behaviors required by the two defined prefixes are entirely
> explained by the cookie flags that exist today, and are implemented by
> simply requiring those flags to be present or absent in particular
> combinations.  This means that cookies created with these prefixes will
> behave exactly the same in today's browsers as they will in future browsers
> that enforce restrictions on prefixed cookies. I think there's value there.
>
> My intuition is that these two behaviors cover some large percentage of
> the ways cookies are used today. My goal was to pave those cowpaths, not to
> blaze new trails. I'd suggest that session management is probably ripe for
> some trailblazing, but it's not clear to me that bending cookies around in
> new directions is the best way of doing that. Personally, I'd like to
> introduce as little new complexity as possible while addressing the most
> dire needs.
>
> On Wed, Dec 23, 2015 at 6:12 AM, Adam Barth <w3c@adambarth.com> wrote:
>
>> == Issues with draft-west-cookie-prefixes-05 ==
>>
>> 1) As currently written, the __Secure- prefix is not as secure as the
>> __Host- prefix because it supports the Domain attribute.  For example, if
>> you wanted to recommend the most secure way to use cookies (including this
>> feature), you'd recommend using __Host- rather than __Secure-.  In order
>> for the names of the protocol elements to be self-describing, we should use
>> __Secure- for the most secure option.
>>
>
> I understand the concern. On the other hand, we have a cookie attribute
> named "secure", and it makes some degree of sense for the prefix to match
> the attribute it requires. Do you have a suggestion for a name that would
> force that flag to be set, while not causing the confusion you've flagged?
>

I know these are ugly, so don't throw eggs at me, but I would maybe suggest
__RequireSecureFlag- and __RequireHostScoped- ...? On the plus side,
they're more descriptive, but they are definitely longer and uglier.


>
>
>> 2) Even with these extensions, there's still no way to use cookies in a
>> way that matches the web origin concept.  Specifically, even if you use
>> __Host- and set all the attribute correctly, your cookies are still shared
>> between all the ports on a given host, which is different than web origins
>> because web origins are determined by the scheme, host, and port.  Security
>> problems commonly arise because these sorts of "cracks" between different
>> security models.  For better security, there should be a way to use cookies
>> with a security model that matches up with web origins.
>>
>
> An earlier draft did define an "Origin" prefix. When I realized that that
> was inaccurate I changed the prefix to "Host" to reflect the things that
> status quo cookies could lock down without additions instead of adding
> support for ports, due to the considerations noted at the top of this email.
>
> I'm not fundamentally opposed to adding support for ports to (prefixed)
> cookies if folks think that's a good use of our time. It doesn't seem like
> it would be terribly difficult to do. It forgoes a bit of the simplicity of
> the current draft, but might make up for it with the more robust alignment
> with the origin model.
>
>
>> == Proposal ==
>>
>> I'm sure there will be endless bikeshedding about the syntax for cookie
>> prefixes, but I'd like to make a proposal for a slightly different syntax
>> (with different semantics) that addresses the issues I've raised above:
>>
>> Set-Cookie: ['self']-SID=12345; Secure; Path=/
>> Set-Cookie: [*.example.com]-SID=12345; Secure; Domain=example.com
>> Set-Cookie: [*.example.com:*]-SID=12345; Secure; Domain=example.com
>> Set-Cookie: [/foo/bar]-SID=12345; Secure; Path=/foo/bar
>>
>> In this approach, the cookie prefix indicates the scope of the cookie:
>>
>>  * In the first example, the prefix ['self']- restricts the scope of the
>> cookie to the scheme, host, and port from which the cookie was set.
>>  * In the second example, the cookie's scope is example.com and all of
>> its subdomains, but restricted to the original port.
>>  * In the third example, the scope is expanded to include all the ports.
>>  * In the fourth example, the scope is the current scheme, host, and port
>> as well as the path /foo/bar.
>>
>> I've borrowed the syntax from CSP's source-list: <
>> http://www.w3.org/TR/CSP2/#source-list-syntax>.  Specifically, the
>> grammar for what goes inside the brackets would be roughly:
>>
>> "'self'" / host-source / path-part
>>
>> Obviously, we can continue to bikeshed the syntax, but this syntax also
>> lets you use a short sequence when you want to match the web origin
>> exactly: [/]-
>>
>
> My initial reaction is that, aesthetically, this is a bit beyond the pale.
> `__Secure-` is ugly, source lists are even uglier. :) More constructively,
> I agree completely that the syntax is more expressive, but I wonder whether
> it is helpful.
>
> That is, it certainly gives the server more information about a particular
> cookie's scope, but it's not clear to me that we'd actually want developers
> to use many of the options it provides. For instance, I'd prefer to provide
> no special affordance for the `path` attribute, because doing so encourages
> the belief that there's a relevant security boundary between
> `[origin]/path1` and `[origin]/path2`. Likewise, the `*.example.com` case
> seems to encourage usage patterns that allow important data to slip between
> origins in a way that I'd prefer to discourage.
>
> Where would you expect to see this syntax used? Would it solve problems
> that `__Secure` and `__Host` or `__Origin` wouldn't?
>
> More controversially, we might want to make these prefixes *authoritative*
>> for the scope, meaning they would override any scope-related cookie
>> attributes.  In the near term, we would still recommend that servers send
>> the cookie attributes as well as the prefixes, but having the prefixes
>> override the attributes gives us the flexibility in the future to
>> depreciate the scoping attributes.
>>
>
> Could you explain this a bit more? I don't follow what you mean by making
> the prefixes authoritative for the scope.
>
> Thanks!
>
> -mike
>