Re: [http-state] Is this an omission in the parser rules of draft-ietf-httpstate-cookie-21?

"Roy T. Fielding" <fielding@gbiv.com> Tue, 15 February 2011 03:23 UTC

Return-Path: <fielding@gbiv.com>
X-Original-To: http-state@core3.amsl.com
Delivered-To: http-state@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id CF9383A6E29 for <http-state@core3.amsl.com>; Mon, 14 Feb 2011 19:23:03 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -106.599
X-Spam-Level:
X-Spam-Status: No, score=-106.599 tagged_above=-999 required=5 tests=[AWL=-4.000, BAYES_00=-2.599, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZY1gxG3XDr+q for <http-state@core3.amsl.com>; Mon, 14 Feb 2011 19:23:02 -0800 (PST)
Received: from homiemail-a71.g.dreamhost.com (caiajhbdcbhh.dreamhost.com [208.97.132.177]) by core3.amsl.com (Postfix) with ESMTP id B262D3A6E21 for <http-state@ietf.org>; Mon, 14 Feb 2011 19:23:02 -0800 (PST)
Received: from homiemail-a71.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a71.g.dreamhost.com (Postfix) with ESMTP id 34BAA428072; Mon, 14 Feb 2011 19:23:27 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gbiv.com; h=subject:mime-version :content-type:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to; q=dns; s=gbiv.com; b=lQZPnGuLnR0ARtqz ygkZHOo9IdMSafg9UafbjCqhimX6JpC7yomlkENkm7YNPdLz3kHwDvWSCjKv+cgf AN951juDrxMdf6Ow/xznkBsQH10GFDTwZx7VLfwiBVFUGHFgW6FAO7p3zSW0W2KU zXHkVlZzCtzGCI505B+omLYDq/4=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gbiv.com; h=subject :mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=gbiv.com; bh=FVmPDCjVP+r/fnT/JjDyE2mJgdM=; b=cr3pPu663QzT3iTdb2XF7NzKDf85 xeqV59iYu9jMjMQRm76NLbP5nKxyex6nmGq+LZf3VFYaUIvDyAOhfICAqyUmGzYG xjUA6yo93dgOBNS5Sj8QHbxAJcoIonmAIZOZSs7lNX07JO1KSMvlL0WvHAal/GzV SqanAs+AazTdjKs=
Received: from [192.168.1.84] (99-21-208-82.lightspeed.irvnca.sbcglobal.net [99.21.208.82]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: fielding@gbiv.com) by homiemail-a71.g.dreamhost.com (Postfix) with ESMTPSA id E114742806E; Mon, 14 Feb 2011 19:23:26 -0800 (PST)
Mime-Version: 1.0 (Apple Message framework v1082)
Content-Type: text/plain; charset="us-ascii"
From: "Roy T. Fielding" <fielding@gbiv.com>
In-Reply-To: <AANLkTinFq7bE_e3SSgdjuFvZ8hGn1xy4Hc1VKwc=vp1D@mail.gmail.com>
Date: Mon, 14 Feb 2011 19:23:26 -0800
Content-Transfer-Encoding: quoted-printable
Message-Id: <49225418-A1AF-4299-8C4F-2E608D34265D@gbiv.com>
References: <20110204184735.26023.qmail@mm01.prod.mesa1.secureserver.net> <AANLkTi=qBVkGwMHqAidtwP5_A8pPrF-Y9MV4jgYS5_QM@mail.gmail.com> <7384878F-C44A-42A4-9694-1BB1C18AA5E6@gbiv.com> <AANLkTinFq7bE_e3SSgdjuFvZ8hGn1xy4Hc1VKwc=vp1D@mail.gmail.com>
To: Adam Barth <ietf@adambarth.com>
X-Mailer: Apple Mail (2.1082)
Cc: http-state@ietf.org
Subject: Re: [http-state] Is this an omission in the parser rules of draft-ietf-httpstate-cookie-21?
X-BeenThere: http-state@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Discuss HTTP State Management Mechanism <http-state.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/http-state>, <mailto:http-state-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/http-state>
List-Post: <mailto:http-state@ietf.org>
List-Help: <mailto:http-state-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/http-state>, <mailto:http-state-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 15 Feb 2011 03:23:03 -0000

On Feb 4, 2011, at 11:29 AM, Adam Barth wrote:
> On Fri, Feb 4, 2011 at 11:24 AM, Roy T. Fielding <fielding@gbiv.com> wrote:
>> On Feb 4, 2011, at 10:51 AM, Adam Barth wrote:
>>> On Fri, Feb 4, 2011 at 10:47 AM, Remy Lebeau <remy@lebeausoftware.org> wrote:
>>>> -------- Original Message --------
>>>> Subject: Re: [http-state] Is this an omission in the parser rules of
>>>> draft-ietf-httpstate-cookie-21?
>>>> From: Adam Barth
>>>> Date: Fri, February 04, 2011 10:19 am
>>>> To: Remy Lebeau
>>>> Cc: http-state@ietf.org
>>>> 
>>>>> The draft gives user agents precise
>>>>> instructions for how to parse all
>>>>> manner of cookies, including cookies with
>>>>> values that contain quote characters. That
>>>>> information is contained in Section 5
>>>> 
>>>> I have re-read Section 5 and I do not see its grammar or parsing rules
>>>> accounting for quoted-string values at all. It only says to remove WSP
>>>> characters surrounding extracted names and values, and quote characters
>>>> are not part of the WSP definition. So what am I missing? Where exactly
>>>> does it say how to unquote a quoted-string used in attribute values?
>>> 
>>> Precisely.  It does not say to unquote a quoted-string because that's
>>> not how cookies work.  The role of the quote character is cookies is
>>> identical to the role of the "!" character.  That is, neither play a
>>> special role in the protocol.  Any representations by the contrary by
>>> 2109 or any other document are fiction and have only caused pain and
>>> misery in the world.
>> 
>> That may be, but the grammar for server generation of set-cookie
>> values is clearly wrong because use of DQUOTE in cookie values is
>> common (roughly 10% of the values in my browser cookie store) and
>> previously defined, even if we consider DQUOTE to be part of the
>> value string.  Let's just change the generating grammar for value to
>> match how cookies are actually parsed and only exclude characters
>> that are known to cause failures.
> 
> The grammar is not used for parsing.  Parsing is defined in Section 5,
> not Section 4.

Parsing for user agents is defined in section 5.  Servers have to
parse cookies as well, and the grammar provided in section 4 is wrong
for both generation and parsing.

Why do you want to push forward a document with a known error in the
grammar?  Just fix it.

This is not a trivial detail.  As written, the specification says
server developers SHOULD break sites like amazon.com.

   cookie-value      = token / ""

The correct grammar is in the original Netscape cookie spec: "This
string is a sequence of characters excluding semi-colon, comma and
white space."  Which easily translates (conservatively) into

   cookie-value      = %x21-2B / %x2D-3A / %x3C-7E / %x80-FF

and it does not conflict with section 5.

....Roy