Re: [http-state] Setting cookies for sibling domains (was Re: Security considerations overview)

Adam Barth <ietf@adambarth.com> Thu, 04 March 2010 00:09 UTC

Return-Path: <ietf@adambarth.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 9BB483A887A for <http-state@core3.amsl.com>; Wed, 3 Mar 2010 16:09:22 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.977
X-Spam-Level:
X-Spam-Status: No, score=-1.977 tagged_above=-999 required=5 tests=[AWL=-0.001, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, WEIRD_PORT=0.001]
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 dz+-tiS76cjD for <http-state@core3.amsl.com>; Wed, 3 Mar 2010 16:09:21 -0800 (PST)
Received: from mail-yw0-f173.google.com (mail-yw0-f173.google.com [209.85.211.173]) by core3.amsl.com (Postfix) with ESMTP id 5DA7C3A8888 for <http-state@ietf.org>; Wed, 3 Mar 2010 16:09:21 -0800 (PST)
Received: by ywh3 with SMTP id 3so781821ywh.31 for <http-state@ietf.org>; Wed, 03 Mar 2010 16:09:19 -0800 (PST)
Received: by 10.150.56.31 with SMTP id e31mr1680298yba.259.1267661359036; Wed, 03 Mar 2010 16:09:19 -0800 (PST)
Received: from mail-iw0-f194.google.com (mail-iw0-f194.google.com [209.85.223.194]) by mx.google.com with ESMTPS id 23sm388iwn.6.2010.03.03.16.09.18 (version=SSLv3 cipher=RC4-MD5); Wed, 03 Mar 2010 16:09:18 -0800 (PST)
Received: by iwn32 with SMTP id 32so835471iwn.18 for <http-state@ietf.org>; Wed, 03 Mar 2010 16:09:17 -0800 (PST)
MIME-Version: 1.0
Received: by 10.231.157.83 with SMTP id a19mr900106ibx.41.1267661051109; Wed, 03 Mar 2010 16:04:11 -0800 (PST)
In-Reply-To: <5c4444771003031540j3d1092dbx2dfa2dc4d455dfe8@mail.gmail.com>
References: <5c4444771003031540j3d1092dbx2dfa2dc4d455dfe8@mail.gmail.com>
From: Adam Barth <ietf@adambarth.com>
Date: Wed, 3 Mar 2010 16:03:51 -0800
Message-ID: <5c4444771003031603q77d84c02x79e6952535e8bd0a@mail.gmail.com>
To: Mark Pauley <mpauley@apple.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: http-state <http-state@ietf.org>
Subject: Re: [http-state] Setting cookies for sibling domains (was Re: Security considerations overview)
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, 04 Mar 2010 00:09:22 -0000

On Wed, Mar 3, 2010 at 3:40 PM, Adam Barth <ietf@adambarth.com> wrote:
> On Wed, Mar 3, 2010 at 3:38 PM, Mark Pauley <mpauley@apple.com> wrote:
>> It would appear that this is covered by 4.1.2.2
>>
>> We (and many other browsers) do allow setting a cookie with domain .bar.example.com from .foo.example.
>
> Oh, I thought I tested that case.  Give me a few minutes to write a
> test case for this behavior.
>
>> Indeed, some web applications rely on this behavior.  The compromise is that we'll allow .foo.example.com to set a cookie for .bar.example.com if and only if .example.com is not a Top Level (or registry controlled) Domain.
>
> I find that surprising, but that's why we have tests.  :)

I'm not able to reproduce this behavior with Safari 4.0.4.  Here's my test case:

http://subdomain.home.example.org:8888/cookie-parser?domain0042 responds with

Set-Cookie: foo=bar; domain=.sibling.home.example.org
Location: http://sibling.home.example.org:8888/cookie-parser-result?domain0042

but no cookie is sent when requesting
http://sibling.home.example.org:8888/cookie-parser-result?domain0042.

Is there something I'm doing wrong?

If you want to try this at on your own machine, you can "git clone
git://github.com/abarth/http-state.git" and then follow the
instructions at
<http://github.com/abarth/http-state/blob/master/tests/README>.  (Note
that this test case doesn't quite fit into our testing harness because
we need to start on subdomain.home.example.org instead of the usual
home.example.org.)

Thanks,
Adam