[jose] Re: Do you need the JWP JSON Serialization?

David Waite <david@alkaline-solutions.com> Wed, 14 August 2024 18:06 UTC

Return-Path: <david@alkaline-solutions.com>
X-Original-To: jose@ietfa.amsl.com
Delivered-To: jose@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 10188C180B5A for <jose@ietfa.amsl.com>; Wed, 14 Aug 2024 11:06:18 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.905
X-Spam-Level:
X-Spam-Status: No, score=-1.905 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
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 0S7HQlg4MJev for <jose@ietfa.amsl.com>; Wed, 14 Aug 2024 11:06:14 -0700 (PDT)
Received: from caesium6.alkaline.solutions (caesium6.alkaline.solutions [157.230.133.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5596DC180B6E for <jose@ietf.org>; Wed, 14 Aug 2024 11:06:10 -0700 (PDT)
From: David Waite <david@alkaline-solutions.com>
Authentication-Results: caesium6.alkaline.solutions; auth=pass smtp.mailfrom=david@alkaline-solutions.com
Message-Id: <56D28EF4-6DF2-4A8D-B5EC-EDF10FF6D409@alkaline-solutions.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_654AF6E4-08B0-4E73-871B-558C0BB398CD"
Mime-Version: 1.0
Date: Wed, 14 Aug 2024 12:05:58 -0600
In-Reply-To: <CAN8C-_+fh5UxVjvoQe5+VMZoWufkHM9CYaNbFagkoeN-ZNY4=A@mail.gmail.com>
To: Orie Steele <orie@transmute.industries>
References: <SJ0PR02MB74391ECC2D8130E1F0994C1AB7BF2@SJ0PR02MB7439.namprd02.prod.outlook.com> <CA+k3eCQNWURoC=PcgNsmqGNhbd0Vpu9ukSwx+ZzJ7zLLS1hckg@mail.gmail.com> <CAN8C-_LYKz2Vg6gDQv3mRX4KsJnESeyc=Af58V_DBiLGV_Hqpg@mail.gmail.com> <CA+k3eCSw6+C3Hs3ijsUrO1rVNJbHTt8ggAp6AtcLkgRoH6vVFw@mail.gmail.com> <CAN8C-_+fh5UxVjvoQe5+VMZoWufkHM9CYaNbFagkoeN-ZNY4=A@mail.gmail.com>
X-Spamd-Bar: -
Message-ID-Hash: EPUQ3MQQ3OGJVLUQRQBPSGW4QL6YJD6W
X-Message-ID-Hash: EPUQ3MQQ3OGJVLUQRQBPSGW4QL6YJD6W
X-MailFrom: david@alkaline-solutions.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-jose.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: Brian Campbell <bcampbell@pingidentity.com>, "jose@ietf.org" <jose@ietf.org>
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [jose] Re: Do you need the JWP JSON Serialization?
List-Id: Javascript Object Signing and Encryption <jose.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/jose/XVZyJXYVL_EdIJcaAwBMkEqrKRY>
List-Archive: <https://mailarchive.ietf.org/arch/browse/jose>
List-Help: <mailto:jose-request@ietf.org?subject=help>
List-Owner: <mailto:jose-owner@ietf.org>
List-Post: <mailto:jose@ietf.org>
List-Subscribe: <mailto:jose-join@ietf.org>
List-Unsubscribe: <mailto:jose-leave@ietf.org>

> On Aug 8, 2024, at 12:18 PM, Orie Steele <orie@transmute.industries> wrote:
> 
> That's fair : )
> 
> Let's replace "suspicion" with "I would have argued for a different design".
> 
> In JOSE, ~ is just used as a placeholder for "missing unprotected header".

A tilde has two meanings in JWP, neither of which universally map to unprotected headers. Since algorithms have a certain amount of flexibility within their layering, I suppose they could potentially map into something like countersignatures in individual cases.

> 
> You still need to validate that the correct mutable data was included, and that no "unexpected mutable data" was included.
> 
> That's a "verifier policy over mutable data".
> 
> In the context of SD-JWT that means checking disclosures, matching their hash to the kbt and making sure the kbt is signed by the cnf.

In SD-JWT, my interpretation is that the use of a custom compact encoding is far more powerful than unprotected headers as it actually provides requirements and guidance on use due to imposing a specific, non-compatible structure. There are edge cases for SD-JWT where the preprocessor MUST be used for claims to otherwise be conformant to their own requirements (such as redacted members of an array). 

There is also no appropriate “must understand” at the JOSE level for things like the key binding JWT or the disclosures. From a layering perspective, it is unfortunate from a layering perspective that we are pushing requirements to understand certain unprotected headers and payload preprocessing requirements onto the payload content type - although that is also somewhat the original point of SD-JWT.

I would argue that unprotected headers in JOSE have insufficient guidance around correct usage by applications. Specifically, while the JOSE header is the union or protected and unprotected parameters, there is no guidance on how applications should deal with verification having non-integrity-protected header values.

The security consideration around algorithm protection is the only place we get close to mentioning that an implementation may need to specifically check that some header parameters are within the protected header, and otherwise leaves this to an application-level choice.

There is also this unfortunate text in RFC 7515, Section 4:

JOSE Header

For a JWS, the members of the JSON object(s) representing the JOSE
Header describe the digital signature or MAC applied to the JWS
Protected Header and the JWS Payload and optionally additional
properties of the JWS.  The Header Parameter names within the JOSE
Header MUST be unique; JWS parsers MUST either reject JWSs with
duplicate Header Parameter names or use a JSON parser that returns
only the lexically last duplicate member name, as specified in
Section 15.12 ("The JSON Object") of ECMAScript 5.1 [ECMAScript].

Talking about duplicate parameter names at the JSON parser level in this context misleads implementers to think that this is talking about duplicates within a protected header or a unprotected header, not duplicates across the two while performing a union to get the JOSE Header. Conversely, applying the “lexically last duplicate” parser call-out might even imply that the unprotected header parameters would acceptably take precedence over the protected header parameters during this union.

(FWIW, COSE defines this collision as a SHOULD, but does indicate a required preference from the protected bucket. It also indicates alg MUST be authenticated, except in the non-enumerated cases where it can't be. Some headers have call outs that that they are appropriate to be in an unprotected header or that they should be in a protected header, but I would not call it a consistent requirement for header definition)

<snip>

> Isn't JWP meant to replace SD-JWT in some cases that require stronger unlinkability?

> IIRC SD-JWT and OAUTH had good reasons to define a JSON Serialization, and if it's used, those users should be able to switch to JWP or CWP in the future.

Since JWP involves distinct headers from multiple parties (and interpretation of these headers potentially by multiple parties), and also has a stronger need for privacy considerations, I would expect far more definition would be needed for unprotected headers in JWP than was present in JWS/JWE or COSE.

Proofs are also iMHO more likely to be involved in a protocol rather than to protect documents/data at rest, due to being generated in response to a particular request. (The expired https://datatracker.ietf.org/doc/html/draft-waite-jws-multi-payload-00 was partially meant to bridge that gap (to allow for applications defining their data as multiple payloads to have a compatible, non-proof mechanism for representation, but I didn’t perceive any traction around that document and have so-far abandoned the effort.)

If a JWP is being transferred in the context of a protocol, there are plenty of other mechanisms to convey additional unprotected data, without the need to define processing rules or privacy considerations for these within JWP.

For those reasons, I’ve been more interested in entertaining specific functionality carve-outs when proposed as part of JWP, rather than a catch-all like unprotected headers.

-DW