Re: Signing Set-Cookie

Martin Thomson <mt@lowentropy.net> Thu, 02 June 2022 00:01 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 24404C14F721 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 1 Jun 2022 17:01:54 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.761
X-Spam-Level:
X-Spam-Status: No, score=-2.761 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=lowentropy.net header.b=poTPcZll; dkim=pass (2048-bit key) header.d=messagingengine.com header.b=yszsYXC0
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UjUUnz6VhoxA for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 1 Jun 2022 17:01:48 -0700 (PDT)
Received: from lyra.w3.org (lyra.w3.org [128.30.52.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6DD9AC14F718 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Wed, 1 Jun 2022 17:01:48 -0700 (PDT)
Received: from lists by lyra.w3.org with local (Exim 4.92) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1nwYFN-00085L-LQ for ietf-http-wg-dist@listhub.w3.org; Wed, 01 Jun 2022 23:59:29 +0000
Resent-Date: Wed, 01 Jun 2022 23:59:29 +0000
Resent-Message-Id: <E1nwYFN-00085L-LQ@lyra.w3.org>
Received: from mimas.w3.org ([128.30.52.79]) by lyra.w3.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <mt@lowentropy.net>) id 1nwYFL-00084C-Qd for ietf-http-wg@listhub.w3.org; Wed, 01 Jun 2022 23:59:27 +0000
Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by mimas.w3.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <mt@lowentropy.net>) id 1nwYFK-0007UC-Ak for ietf-http-wg@w3.org; Wed, 01 Jun 2022 23:59:27 +0000
Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id A91515C0106 for <ietf-http-wg@w3.org>; Wed, 1 Jun 2022 19:59:15 -0400 (EDT)
Received: from imap41 ([10.202.2.91]) by compute3.internal (MEProxy); Wed, 01 Jun 2022 19:59:15 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lowentropy.net; h=cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1654127955; x= 1654214355; bh=uKFa/3VcDyp2wLI4Y2PQggXrff2n+U3UP3k7VMZG4KU=; b=p oTPcZllFlV8Tl5aVZlBvgm5XZ5qC+Yiw0Vy0uPMwZZf5T7U09W8pG1Tm9MuOaITa xNy6JUlhjqGnCKJCRI+rCXgyAQ8O6gVAfO3uTgPd3H2hVZOpBQxU37sc/4JOuk8T fIlA086GOh9UEbiAH7LqNhXzQ1RHg0X1aP64YajaQzm0SPpXBz4gv0HC9wtMV5h4 jL1oCWHes0yuf7xwxLEoqdYZLNpSefia+aRI43+pO76KhLoGHrZ2ii9eVmBrJ28V d6zldjQuJNRX37rQa0/tSh3blQb/wClXun6rl3H5ym8NmyQzFj7vPoXh7NcBs/3Z LD/b21zIE3y22wv895ZMA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1654127955; x=1654214355; bh=u KFa/3VcDyp2wLI4Y2PQggXrff2n+U3UP3k7VMZG4KU=; b=yszsYXC0kaQZP+qO6 snxTktXpph7/dsbLA2dTv9TpB11XH/hhKhaN9g7mMFLjZi2gzXHQdqmH5hveSufH DuRlmAB1d7rbNKV1qkr65V5mrT/4WeCnO3NFg9nuorTan34u3MASMHS6t0oHhZXs ORGC5fzfDYhD1NQPFvWLITsVsIALBg2y4cgouEmZudHpu289/OwTxV8XeWFs4xrr rC4g7HM3r4pf3K7p64a+gy6COA50PX0VcN5sOwe+tbfEGu9NuvWsJOGN4QbjbJVt r16c6k3zrh3igaNxzor1zAi9VB4eV4dPVIq+VhQ5Lr9C1amvbo7o2sy+6jhXXflb 23M7Q==
X-ME-Sender: <xms:U_2XYsrveWRgOZ8YuWcbx8n3Fx3sF5oe2A27rrY0vZyf0dkH-S5IrQ> <xme:U_2XYiqxiNetmRh_9dkJvyzTYMvaHW8LyCKxtqsGABTpnQ0vQHmh2Ft6HsP4nSUCk TqHoGo_z0JEUfuPLF8>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrledugddvgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgfgsehtqh ertderreejnecuhfhrohhmpedfofgrrhhtihhnucfvhhhomhhsohhnfdcuoehmtheslhho figvnhhtrhhophihrdhnvghtqeenucggtffrrghtthgvrhhnpeejhfffleehvedufeejfe dvvdfhvdeiteduheeuffduveduueegleefffffledvfeenucffohhmrghinhepghhithhh uhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepmhhtsehlohifvghnthhrohhphidrnhgvth
X-ME-Proxy: <xmx:U_2XYhODd0qLxRwQucShNWUeXH02BQQW4eZ8l75i73SNeYVhlWQd3g> <xmx:U_2XYj5NDakJgMykJFW-OaLE5eNlIZyV0Xe8uXP9jMxLiAMmo8azgQ> <xmx:U_2XYr5beyMye9gx2Re8Ms970AOGPS3anrENgfStgG2WJk59W9IPuA> <xmx:U_2XYtHJKFo86HuMyu58SSnfI44WNUx9ee0jiSNjPUkK2RgnZ_FdbQ>
Feedback-ID: ic129442d:Fastmail
Received: by mailuser.nyi.internal (Postfix, from userid 501) id 71BC32340076; Wed, 1 Jun 2022 19:59:15 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
User-Agent: Cyrus-JMAP/3.7.0-alpha0-591-gfe6c3a2700-fm-20220427.001-gfe6c3a27
Mime-Version: 1.0
Message-Id: <7dff30c8-faac-413f-8387-f0a5a51fc6ff@beta.fastmail.com>
In-Reply-To: <CACcvr==K0gjhOaBaxt8vK80UYo1tAHVrh78yCcAEMvwx4tT=ag@mail.gmail.com>
References: <A0601849-2870-4150-9926-5FA706D7F6DE@mit.edu> <CACcvr==K0gjhOaBaxt8vK80UYo1tAHVrh78yCcAEMvwx4tT=ag@mail.gmail.com>
Date: Thu, 02 Jun 2022 09:58:56 +1000
From: Martin Thomson <mt@lowentropy.net>
To: ietf-http-wg@w3.org
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=66.111.4.29; envelope-from=mt@lowentropy.net; helo=out5-smtp.messagingengine.com
X-W3C-Hub-DKIM-Status: validation passed: (address=mt@lowentropy.net domain=lowentropy.net), signature is good
X-W3C-Hub-DKIM-Status: validation passed: (address=mt@lowentropy.net domain=messagingengine.com), signature is good
X-W3C-Hub-Spam-Status: No, score=-6.8
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, W3C_AA=-1, W3C_DB=-1, W3C_IRA=-1, W3C_WL=-1
X-W3C-Scan-Sig: mimas.w3.org 1nwYFK-0007UC-Ak eae9f7e45c1ffd7d7b10655ebfa96d7f
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Signing Set-Cookie
Archived-At: <https://www.w3.org/mid/7dff30c8-faac-413f-8387-f0a5a51fc6ff@beta.fastmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/40062
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>

Yeah, what Nick said.

Cookie concatenation has a special carve-out in all HTTP versions past 1.x; I see no real harm in making another for Set-Cookie.

On Thu, Jun 2, 2022, at 09:20, Nick Harper wrote:
> A Set-Cookie header could have a comma in it (e.g. in the Expires= or 
> Path= parts), which means that it's probably possible for two different 
> combinations of Set-Cookie headers to be concatenated/canonicalized to 
> the same value. I'm not certain there's an attack here, but this seems 
> potentially problematic enough that this should be given more 
> consideration.
>
> On Wed, Jun 1, 2022 at 2:39 PM Justin Richer <jricher@mit.edu> wrote:
>> The Set-Cookie header syntax is weird in that it doesn’t allow for concatenation in the normal List syntax. The Signature spec relies on this concatenation for the combination of values of headers that show up multiple times. This discrepancy is called out in this issue:
>> 
>> https://github.com/httpwg/http-extensions/issues/1183
>> 
>> However, on further investigation, I don’t think this actually causes a problem. The concatenation process outlined in Signatures still works on multiple Set-Cookie values, the only weird thing is that the RESULT of that process cannot itself be parsed as a valid Set-Cookie header. 
>> 
>> But the thing is, it doesn’t have to be parsed. It just has to exist as a string in the signature base, and be re-created by both signer and verifier in a consistent way. 
>> 
>> I’m planning on closing this issue with a note in the appropriate section of the signature spec, but if there’s something I’m missing about this, please chime in.
>> 
>>  — Justin