Re: [http-state] The Domain attribute (was Re: I-D Action:draft-ietf-httpstate-cookie-20.txt)

"Paul E. Jones" <paulej@packetizer.com> Thu, 06 January 2011 22:20 UTC

Return-Path: <paulej@packetizer.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 879BF3A6F29 for <http-state@core3.amsl.com>; Thu, 6 Jan 2011 14:20:31 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.939
X-Spam-Level:
X-Spam-Status: No, score=-1.939 tagged_above=-999 required=5 tests=[AWL=-0.540, BAYES_00=-2.599, J_CHICKENPOX_66=0.6, J_CHICKENPOX_73=0.6]
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 ACQkYBM0ComB for <http-state@core3.amsl.com>; Thu, 6 Jan 2011 14:20:28 -0800 (PST)
Received: from dublin.packetizer.com (dublin.packetizer.com [75.101.130.125]) by core3.amsl.com (Postfix) with ESMTP id 7C4FF3A6B9E for <http-state@ietf.org>; Thu, 6 Jan 2011 14:20:28 -0800 (PST)
Received: from sydney (rrcs-98-101-155-83.midsouth.biz.rr.com [98.101.155.83]) (authenticated bits=0) by dublin.packetizer.com (8.14.2/8.14.2) with ESMTP id p06MMRQs028135 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Thu, 6 Jan 2011 17:22:33 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=packetizer.com; s=dublin; t=1294352553; bh=/ftQs42vo0coePYKX4l/rmog8ZKZct6Z06+zJYUh/MQ=; h=From:To:Cc:References:In-Reply-To:Subject:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; b=adv+d4kUDtIT1S18pSz2YZS8WN3DmONYspeUZWS3/GbY06tA+cYQxEsBqV1p6eViO nO6rCybGtErdHtrXOAhzad0L1PAoi6kg58sV91AivzO615cJBqzM+adDBUQu++eBXT 4eN7bR1TvsHTI9UNbwISCz2j1oUCKR88rIHNbiR4=
From: "Paul E. Jones" <paulej@packetizer.com>
To: 'Adam Barth' <ietf@adambarth.com>
References: <AANLkTinK+2sfe4UZLKF5G0MLrQ6es2BfTHwtT769sgSM@mail.gmail.com>
In-Reply-To: <AANLkTinK+2sfe4UZLKF5G0MLrQ6es2BfTHwtT769sgSM@mail.gmail.com>
Date: Thu, 06 Jan 2011 17:22:19 -0500
Message-ID: <07d501cbadf0$31e13470$95a39d50$@packetizer.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
X-Mailer: Microsoft Outlook 14.0
Thread-Index: AQOsylhA7Jc/U76u6c6ZWuz0pv934ZACQIyw
Content-Language: en-us
Cc: http-state@ietf.org
Subject: Re: [http-state] The Domain attribute (was Re: I-D Action:draft-ietf-httpstate-cookie-20.txt)
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: Thu, 06 Jan 2011 22:20:31 -0000

Adam,

Thanks for the clarification.  Now I understand that many of the decisions
made were based on real-world implementations and a desire to make things no
worse than they already are. ;-)

Perhaps the one point of disagreement is whether this syntax is valid:
domain-value      = <subdomain> | ""

I agree that one could omit the Domain attribute and probably should, but
the above syntax is consistent with text that talks about an "empty string".
We have to give that treatment, since an empty string actually means
something.

The empty string is also used in this example:
Set-Cookie: lang=; Expires=Sun, 06 Nov 1994 08:49:37 GMT

For this reason, this might be another area where we need to consider a
syntax change:
cookie-pair       = cookie-name "=" cookie-value
cookie-name       = token
cookie-value      = token | ""
                         ^^^^^

These are the only examples I can think of where I've seen attributes that
do not have assigned values (i.e., have an empty strings) on the wire, each
done so deliberately and with a particular meaning.

In any case, I don't have a strong preference and if the group wants to
change the syntax.  That's OK.  It just seems allowing an empty string for
"Domain" is more consistent with the text than not.

Paul

> -----Original Message-----
> From: Adam Barth [mailto:ietf@adambarth.com]
> Sent: Thursday, January 06, 2011 3:50 PM
> To: Paul E. Jones
> Cc: http-state@ietf.org
> Subject: The Domain attribute (was Re: [http-state] I-D Action:draft-
> ietf-httpstate-cookie-20.txt)
> 
> On Thu, Jan 6, 2011 at 7:57 AM, Paul E. Jones <paulej@packetizer.com>
> wrote:
> > Adam,
> >
> > In the RFC 2109, the "domain" attribute is optional.  Specifically, it
> says:
> >
> >   Domain=domain
> >      Optional.  The Domain attribute specifies the domain for which
> > the
> >      cookie is valid.  An explicitly specified domain must always
> > start
> >      with a dot.
> >
> >  It also defined a default:
> >   Domain Defaults to the request-host.  (Note that there is no dot at
> >          the beginning of request-host.)
> 
> Right.
> 
> > I found this in the -20 draft:
> >
> > 4.1.2.3:
> >   If the server omits the Domain attribute, the user
> >   agent will return the cookie only to the origin server.
> >
> >      WARNING: Some existing user agents treat an absent Domain
> >      attribute as if the Domain attribute were present and contained
> >      the current host name.  For example, if example.com returns a
> > Set-
> >      Cookie header without a Domain attribute, these user agents will
> >      erroneously send the cookie to www.example.com as well.
> >
> > If I received a cookie without a domain from test.example.com, I would
> > assume the cookie's domain is "test.example.com".  The wording above
> > confuses me a little, as I would bind the cookie to the host I
> accessed.
> > The first sentence in the WARNING seems like what I should do, but the
> > example presented is not the origin server or the "current host
> name".
> > I agree that it would be an error for a browser to assume a larger
> > domain scope than just the single host being accessed.  But, I would
> > think that absence of or an empty string for "Domain" would be bound
> > only to the server being accessed.  I believe that is the intent, as
> > stated in other sections, but the warning text seems to suggest
> otherwise when I read it.
> 
> Right, the issue is that some browsers forget to set the host-only flag
> on the cookie if you omit the Domain attribute.  That causes the cookie
> to be returned to the origin server as well as all subdomains of the
> origin server's host name.
> 
> > In Section 5.2.3, this text appears:
> >   If the attribute-value is empty, the behavior is undefined.
> > However,
> >   user agent SHOULD ignore the cookie-av entirely.
> >
> > Why would the behavior be undefined?  Why would these not be treated
> > identically?
> > Set-Cookie: mycookie=myvalue; path=/
> > Set-Cookie: mycookie=myvalue; path=/; domain=
> 
> It's undefined because different implementations do different things and
> I didn't have the energy or the inclination to beat them up on this
> point.  They should do what the document suggests, but it's not the end
> of the world fi they don't.
> 
> > Why isn't an empty string a valid value?  I ask, because we assign an
> > empty value internally.  In 5.3, paragraph 4, we have:
> >
> >   4.   If the cookie-attribute-list contains an attribute with an
> >        attribute-name of "Domain":
> >
> >           Let the domain-attribute be the attribute-value of the last
> >           attribute in the cookie-attribute-list with an
> > attribute-name
> >           of "Domain".
> >
> >        Otherwise:
> >
> >           Let the domain-attribute be the empty string.
> >
> > So, this does suggest "domain=" would be the same as absence of the
> > domain parameter, no?
> 
> Well, the complexity actually arises when the server provides multiple
> Domain attributes, some of which are the empty string.  Which one
> actually controls the result varies.
> 
> The rules are written such that if you follow them, you get reasonable
> behavior that matches practice.  There's also some wiggle room to in
> this extreme corner case (multiple attributes, one of which is the empty
> string).  We could nail that issue down, but it didn't seem worth the
> hassle.
> 
> > Paragraph 6 then explains that in such cases, the domain is  assigned
> >to "the canonicalized request-host", which is consistent.
> >
> > So, any reason why the Domain a/v syntax isn't this?
> > domain-value      = <subdomain> | ""
> 
> Just because it's nonsense semantically and an interoperability
> sandtrap.  If you'd like to use the empty string, just omit the Domain
> attribute instead.  Your life and everyone else's life will be happier
> for it.
> 
> Adam
> 
> 
> >> -----Original Message-----
> >> From: http-state-bounces@ietf.org
> >> [mailto:http-state-bounces@ietf.org]
> >> On Behalf Of Internet-Drafts@ietf.org
> >> Sent: Sunday, December 19, 2010 2:00 PM
> >> To: i-d-announce@ietf.org
> >> Cc: http-state@ietf.org
> >> Subject: [http-state] I-D Action:draft-ietf-httpstate-cookie-20.txt
> >>
> >> A New Internet-Draft is available from the on-line Internet-Drafts
> >> directories.
> >> This draft is a work item of the HTTP State Management Mechanism
> >> Working Group of the IETF.
> >>
> >>
> >>       Title           : HTTP State Management Mechanism
> >>       Author(s)       : A. Barth
> >>       Filename        : draft-ietf-httpstate-cookie-20.txt
> >>       Pages           : 44
> >>       Date            : 2010-12-19
> >>
> >> This document defines the HTTP Cookie and Set-Cookie header fields.
> >> These header fields can be used by HTTP servers to store state
> >> (called
> >> cookies) at HTTP user agents, letting the servers maintain a stateful
> >> session over the mostly stateless HTTP protocol.  Although cookies
> >> have many historical infelicities that degrade their security and
> >> privacy, the Cookie and Set-Cookie header fields are widely used on
> >> the Internet.Editorial Note (To be removed by RFC Editor)
> >>
> >> If you have suggestions for improving this document, please send
> >> email to <mailto:http-state@ietf.org>.  Suggestions with test cases
> >> are especially appreciated.  Further Working Group information is
> >> available from <https://tools.ietf.org/wg/httpstate/>.
> >>
> >> A URL for this Internet-Draft is:
> >> http://www.ietf.org/internet-drafts/draft-ietf-httpstate-cookie-20.tx
> >> t
> >>
> >> Internet-Drafts are also available by anonymous FTP at:
> >> ftp://ftp.ietf.org/internet-drafts/
> >>
> >> Below is the data which will enable a MIME compliant mail reader
> >> implementation to automatically retrieve the ASCII version of the
> >> Internet-Draft.
> >
> >