Re: draft-ietf-httpbis-header-structure: handling multiple field values

Poul-Henning Kamp <phk@phk.freebsd.dk> Tue, 12 May 2020 21:25 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 DA6373A0A94 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 12 May 2020 14:25:38 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.648
X-Spam-Level:
X-Spam-Status: No, score=-2.648 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
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 g2bes9al-yvW for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 12 May 2020 14:25:37 -0700 (PDT)
Received: from lyra.w3.org (lyra.w3.org [128.30.52.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5B4483A0A84 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 12 May 2020 14:25:37 -0700 (PDT)
Received: from lists by lyra.w3.org with local (Exim 4.92) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1jYcMV-0007ym-Mx for ietf-http-wg-dist@listhub.w3.org; Tue, 12 May 2020 21:22:51 +0000
Resent-Date: Tue, 12 May 2020 21:22:51 +0000
Resent-Message-Id: <E1jYcMV-0007ym-Mx@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 <phk@critter.freebsd.dk>) id 1jYcMU-0007y1-I2 for ietf-http-wg@listhub.w3.org; Tue, 12 May 2020 21:22:50 +0000
Received: from phk.freebsd.dk ([130.225.244.222]) by mimas.w3.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <phk@critter.freebsd.dk>) id 1jYcMR-0004fW-O4 for ietf-http-wg@w3.org; Tue, 12 May 2020 21:22:50 +0000
Received: from critter.freebsd.dk (v-critter.freebsd.dk [192.168.55.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by phk.freebsd.dk (Postfix) with ESMTPS id CCB791AF183; Tue, 12 May 2020 21:22:32 +0000 (UTC)
Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id 04CLMWvI011781 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 12 May 2020 21:22:32 GMT (envelope-from phk@critter.freebsd.dk)
Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id 04CLMVa8011780; Tue, 12 May 2020 21:22:31 GMT (envelope-from phk)
To: Julian Reschke <julian.reschke@gmx.de>
cc: Ian Clelland <iclelland@google.com>, Willy Tarreau <w@1wt.eu>, HTTP Working Group <ietf-http-wg@w3.org>
In-reply-to: <6121e33e-46d3-e361-9e4e-ad0158a0a8c5@gmx.de>
From: "Poul-Henning Kamp" <phk@phk.freebsd.dk>
References: <f55521dd-e1d3-d925-688c-c472ad67bfb4@gmx.de> <20200512172347.GB4817@1wt.eu> <CAK_TSXJ3o7F9x63MSYyEhr7de0vO1Yu2s8JnjkhT7n4BQiQp+A@mail.gmail.com> <706ee02a-2ecc-6cce-0754-909d6b9f4edd@gmx.de> <CAK_TSXJxex1t32EnfPqYUKhTdqJZFbRf36_FLKJeP2Tqu7RXMg@mail.gmail.com> <4045931b-06b3-9b76-106f-773499b8374b@gmx.de> <11162.1589312096@critter.freebsd.dk> <6121e33e-46d3-e361-9e4e-ad0158a0a8c5@gmx.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-ID: <11778.1589318551.1@critter.freebsd.dk>
Content-Transfer-Encoding: quoted-printable
Date: Tue, 12 May 2020 21:22:31 +0000
Message-ID: <11779.1589318551@critter.freebsd.dk>
Received-SPF: pass client-ip=130.225.244.222; envelope-from=phk@critter.freebsd.dk; helo=phk.freebsd.dk
X-W3C-Hub-Spam-Status: No, score=-4.9
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, W3C_AA=-1, W3C_IRA=-1, W3C_WL=-1
X-W3C-Scan-Sig: mimas.w3.org 1jYcMR-0004fW-O4 47ddff279ee51349c83918c8b4fb7b7c
X-Original-To: ietf-http-wg@w3.org
Subject: Re: draft-ietf-httpbis-header-structure: handling multiple field values
Archived-At: <https://www.w3.org/mid/11779.1589318551@critter.freebsd.dk>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/37611
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>

--------
In message <6121e33e-46d3-e361-9e4e-ad0158a0a8c5@gmx.de>de>, Julian Reschke writes
:

>The issue here is that combining
>
>   Foo: "a
>
>and
>
>   Foo: b"
>
>into
>
>   Foo: "a, b"
>
>*hides* an issue, and no failure will occur. Furthermore, we not only
>get no failure, but the resulting string may vary depending on how the
>fields were combined.
>
>I get that it's unavoidable that this *can* happen, but does this mean
>we should *disallow* failing for that input?

Yes, we should disallow it, because that would cause a valid request
to fail unless a proxy implemented a particular way is in the path.

I think we say this very clearly on page 23:

   When generating input_bytes, parsers MUST combine all lines in the
   same section (header or trailer) that case-insensitively match the
   field name into one comma-separated field-value, as per [RFC7230],
   Section 3.2.2; this assures that the entire field value is processed
   correctly.

Poul-Henning

PS: I think your example is wrong, the combined header would be:

    Foo: "a,b"

Because there is an important asymmetry in RFC7230/3.2.2.

A sender is required to know the syntax of the header is a comma
separated list, before can split the header.

A receiver on the other hand is under no such obligation, and therefore

   "…by appending each subsequent field value to
   the combined field value in order, separated by a comma."

should be interpreted narrowly:  Only a comma, not whitespace.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.