Re: Review of draft-ietf-httpbis-message-signatures-13

Kyle Rose <krose@krose.org> Fri, 18 November 2022 14:46 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 103ACC14CE35 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 18 Nov 2022 06:46:43 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -5.048
X-Spam-Level:
X-Spam-Status: No, score=-5.048 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, HTML_MESSAGE=0.001, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=krose.org
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 RVFntyb2HuUj for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 18 Nov 2022 06:46:38 -0800 (PST)
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 26A07C14CE47 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Fri, 18 Nov 2022 06:46:37 -0800 (PST)
Received: from lists by lyra.w3.org with local (Exim 4.94.2) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1ow2bC-00386Q-SU for ietf-http-wg-dist@listhub.w3.org; Fri, 18 Nov 2022 14:44:10 +0000
Resent-Date: Fri, 18 Nov 2022 14:44:10 +0000
Resent-Message-Id: <E1ow2bC-00386Q-SU@lyra.w3.org>
Received: from titan.w3.org ([128.30.52.76]) by lyra.w3.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from <krose@krose.org>) id 1ow2bA-00384n-O3 for ietf-http-wg@listhub.w3.org; Fri, 18 Nov 2022 14:44:08 +0000
Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by titan.w3.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from <krose@krose.org>) id 1ow2b8-00DMSM-Sd for ietf-http-wg@w3.org; Fri, 18 Nov 2022 14:44:08 +0000
Received: by mail-wr1-x430.google.com with SMTP id j15so8904993wrq.3 for <ietf-http-wg@w3.org>; Fri, 18 Nov 2022 06:44:06 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=krose.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Lh5yPIIceCEkXDvVqGh0kxycEiuCATp+D7tXiyEL7To=; b=TRZSkwS1H4nhZUvIJA6n3alZpV4YLpCBbf2zgJqlYM8mhoyJLkl282Rp3m5kQMr6bk CUeQRJJi1TZqauW5Ts1dtUWljAgEnhuiq7jEtj9s2neickWHArYS6Ssfaq/jfDbzyI6V ilYKVfajhoSl+Px9H5Ng/0lJ0OjG42CAZ0ASs=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Lh5yPIIceCEkXDvVqGh0kxycEiuCATp+D7tXiyEL7To=; b=qMPX6uf4D77mZLw5L8PHmNc7b+AMVNpIG7pR3Kj86OWtBSYkiC0DT7hZufa7zWxCMP gt2w+fNCUrZU8DdN9SMjkbPFJtZvkRDEk2if1y34gSoaomJlh4GzCVrDgH+Zm6gzXvdx 5KyyqvFJ8nNW5ONbbXLAd0SrOji7x0gkMnpggx81rhONyjw7Dh55z+ElGqV7/93yjuLe I57h6hsChoKu+5r9ApUsQqMMFQppD9IHJivr+ZZuMCfW6DnsR+SXaT6ZKpZFi1hKN5KD JoTXGtZrH3ghUjgUDoedUW6CMhxpKCwHT44H1A0lCHxTW3NGHICyQd8CnX7YkJ+Q9CO2 z1rg==
X-Gm-Message-State: ANoB5plx/4PkkLfjHjITflBIgbJuCssovltzyqcd46TQR9QFqbT7rbKD cVF1lku0qt9o+mQ855r7bDZ1eG968ZlZnRJ7L9QyYg==
X-Google-Smtp-Source: AA0mqf6XDOhvvWupxBS0unkmie/UFDPfQMNj+fweoFfO6gfkL/cyBWzBmTN9f7PU390p8s9Do7Yrk8rF5Vof9ahBFzk=
X-Received: by 2002:adf:f187:0:b0:236:6613:afe6 with SMTP id h7-20020adff187000000b002366613afe6mr4400818wro.702.1668782634516; Fri, 18 Nov 2022 06:43:54 -0800 (PST)
MIME-Version: 1.0
References: <CAJU8_nVC+dmetAD=wjCFqMwFGmNJesCDu6gOWN1eA3zsfLgmFA@mail.gmail.com> <AB0EB278-2E1A-44D3-B720-9210754A4539@mit.edu>
In-Reply-To: <AB0EB278-2E1A-44D3-B720-9210754A4539@mit.edu>
From: Kyle Rose <krose@krose.org>
Date: Fri, 18 Nov 2022 09:43:43 -0500
Message-ID: <CAJU8_nUxyMKhrwDAN5j6AoUeXMzQYbzqStcfZKiqHt+owe5MVw@mail.gmail.com>
To: Justin Richer <jricher@mit.edu>
Cc: HTTP Working Group <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary="00000000000023584805edbfbc75"
Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=krose@krose.org; helo=mail-wr1-x430.google.com
X-W3C-Hub-DKIM-Status: validation passed: (address=krose@krose.org domain=krose.org), signature is good
X-W3C-Hub-Spam-Status: No, score=-6.1
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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, W3C_AA=-1, W3C_DB=-1, W3C_IRA=-1, W3C_WL=-1
X-W3C-Scan-Sig: titan.w3.org 1ow2b8-00DMSM-Sd a282692a34f57b79c985130f558b5c03
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Review of draft-ietf-httpbis-message-signatures-13
Archived-At: <https://www.w3.org/mid/CAJU8_nUxyMKhrwDAN5j6AoUeXMzQYbzqStcfZKiqHt+owe5MVw@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/40569
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>

On Wed, Nov 16, 2022 at 1:14 PM Justin Richer <jricher@mit.edu> wrote:

> First, I wanted to clear up some history: several drafts were taken as
> input considerations to this work, most notably
> draft-cavage-http-signatures, draft-ietf-oauth-signed-http-request,
> and draft-yasskin-http-origin-signed-responses. While we looked
> at draft-rundgren-signed-http-requests at some point, we did not base the
> HTTP Message Signatures draft on this document in any way. In fact, that
> draft repeats many of the mistakes of earlier work that we were explicitly
> trying to avoid.
>

Good to know. At any rate, I'm glad we ended up with this draft, because it
covers all the use cases I'm interested in.

* "The context MUST be consistent across all components." I'm not sure what
> it means for a context to be consistent across components. From looking at
> 7.4.3, it seems like the context is defined as whatever information the 2+
> parties to a message share and agree to regard as in-bounds input to a
> message signature. I'm finding it hard to explain the difficulty I'm having
> interpreting this statement, so maybe one way to think about it is by
> asking the question, "What is an example of a context that is
> *inconsistent* across components?"
>
>
> The context is actually just the context of the party either creating or
> verifying the signature, not something that they agree on. Let’s say, as a
> strawman example, the verifier gets a signature that includes “@query” and
> “@query-param” in the signature, for some weird reason. Obviously, these
> values should be derived from the same data source. However, there are some
> web app frameworks that do weird things like override values in a
> pre-parsed query parameters map available to the application. In this case,
> if a naive developer signs a @query-param that ends up coming from the app
> framework instead of the request, or gets overridden by it, then the
> verifier is using two different contexts for these components.
>
> Ultimately, what this text means is that your context needs to be
> consistent and well-defined when you’re pulling your component values out,
> and you shouldn’t change your context in the middle of processing a
> signature.
>

Makes sense. I would then explicitly define what "context" and "consistent"
mean here, maybe replacing the entire second paragraph with something like:

The context for a signed HTTP message comprises the set of components
employed in creating and subsequently verifying an HTTP message signature.
For signatures to be verifiable by receivers, this context MUST be
identical across all parties to the signature (signer and all verifiers). A
context that is shared in such a way shall be regarded as "consistent".
Two notes, however:

   - You might instead choose to define "context" in a similar way in the
   glossary above.
   - "Consistent" is not used anywhere subsequently in the document, so you
   might instead just drop that definition.


* "Within a single list of covered components, each component identifier
> MUST occur only once." Is there a good reason for this? I mean, it's
> pointless extra computation, but restricting it means adding complexity
> around eliminating duplicate identifiers that require more than a simple
> string compare (given the reordering of parameters).
>
>
> There’s no additional computation needed here, really, but it helps define
> the properties of a well-defined signature. What would be the use case of
> allowing a duplicate identifier? You’d get the same value in the signature
> twice, since each component identifier needs to resolve to exactly one
> value.
>

I think I'm not getting my point across adequately. Here are the two
options:

   1. (As stated in the draft) Prohibit multiple instances of a component
   identifier. This means implementations must add checks that a component
   identifier isn't included in a signature multiple times, which would
   involve prohibiting the inclusion of both `"foo";bar;baz` and
   `"foo";baz;bar` but allowing `"foo";bar;baz` and `"foo";bar,quux`.
   2. (My proposal) Allow multiple instances of the same component
   identifier. All this does is make the signature computation and
   verification take slightly longer if a duplicate identifier is included,
   and allowing it means no complex de-duplication checks.

#1 seems like a pointless guardrail in a protocol that otherwise delegates
most of the responsibility to users to do the right thing when choosing a
signature schema.


> Ultimately it’s up to individual applications of this work to figure out
> how best to handle the things that they need to sign, and it’s up to this
> draft to point out, to application developers and architects, what is
> important to figure out for the application to consider. This document
> doesn’t pick which fields to sign or tell you how to mark them (do you use
> “sf”? Do you use “bs”?), but gives you the tools to make that decision.
>

Great. That's what I wanted to hear. (Now apply that same logic to the
duplicate component identifier issue from above.)

* The X-Empty-Header canonicalization example is particularly confusing. I
> recommend changing the way you represent the values in this example (e.g.,
> showing the encoding in octets) to make clear the actual transformation. In
> general, something like the output of hexdump might be a better way to
> encode example canonicalized values in documentation such as this, even if
> only in an appendix. For example:
>
> ```
> 00000000  61 3d 31 2c 20 20 20 20  62 3d 32 3b 78 3d 31 3b  |a=1,
>  b=2;x=1;|
> 00000010  79 3d 32 2c 20 20 20 63  3d 28 61 20 20 20 62 20  |y=2,   c=(a
> b |
> 00000020  20 20 63 29                                       |  c)|
> ```
>
>
> The value is an empty string, there’s no real canonicalization here. The
> confusing bit comes from the document tooling stripping off trailing
> spaces, where the trailing space is in fact required in the signature base
> string. A hex dump for that one example might be better than the line wrap
> hack that’s in there now.
>

In a protocol like this in which every bit sequence matters to correctness,
clarity in the specification and chosen examples is critical. I imagine
you'll get similar feedback from the security directorate if you haven't
already.

2.4. Request-Response Signature Binding:
>
> * If a request lacks a Content-Digest, there appears to be no way to
> cryptographically tie a response to the body of an unsigned request. I can
> definitely see use cases for unsigned requests with signed responses.
>
> I do not understand the point here. You can add anything from the request
> to the response signature using “req” flags.
>

I mean (unless I missed something) there's no way to refer to the content
body of a request, only to headers and request metadata. You can't refer to
(e.g.) @req.body to include the entire body in the signed data. If there's
a header that cryptographically depends on the entire request body (e.g.,
req.content-digest) you can refer to that. (I'll note in doing so you're
also relying on the stack having verified that digest against the message
content before processing the message, which may or may not be fine; I
don't know what the normative language in the HTTP ecosystem for treatment
of Content-Digest is.)

Thanks,
Kyle