Re: [Cbor] Reviews and shepherd for draft-ietf-cbor-cddl-more-control

Carsten Bormann <cabo@tzi.org> Thu, 11 April 2024 13:27 UTC

Return-Path: <cabo@tzi.org>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 5D732C14F691; Thu, 11 Apr 2024 06:27:17 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.888
X-Spam-Level:
X-Spam-Status: No, score=-6.888 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01] 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 Xm8FpgOZLtv8; Thu, 11 Apr 2024 06:27:12 -0700 (PDT)
Received: from smtp.zfn.uni-bremen.de (smtp.zfn.uni-bremen.de [IPv6:2001:638:708:32::21]) (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 ietfa.amsl.com (Postfix) with ESMTPS id 11906C14F696; Thu, 11 Apr 2024 06:27:09 -0700 (PDT)
Received: from eduroam-pool10-144.wlan.uni-bremen.de (eduroam-pool10-144.wlan.uni-bremen.de [134.102.90.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4VFgTh3Q1BzDCgl; Thu, 11 Apr 2024 15:27:04 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <EF87DF03-8483-45DD-AA80-8E885BB78F75@island-resort.com>
Date: Thu, 11 Apr 2024 15:27:03 +0200
Cc: Christian Amsüss <christian@amsuess.com>, "cbor@ietf.org" <cbor@ietf.org>, "draft-ietf-cbor-cddl-more-control@ietf.org" <draft-ietf-cbor-cddl-more-control@ietf.org>
X-Mao-Original-Outgoing-Id: 734534823.492854-47952069030ba0b2c8912c0a99c5bb1f
Content-Transfer-Encoding: quoted-printable
Message-Id: <824851A4-BB83-400A-BBBE-2BFA5E6A4D60@tzi.org>
References: <ZeMG7tpfKLyf3aSz@hephaistos.amsuess.com> <ZhPIC9DyzcpyhjPI@hephaistos.amsuess.com> <3FECD79D-C19A-4F04-BF04-A39AC4962C2D@island-resort.com> <31FEFB97-87CD-4B6D-86A7-06CBE12D51E8@tzi.org> <EF87DF03-8483-45DD-AA80-8E885BB78F75@island-resort.com>
To: "lgl island-resort.com" <lgl@island-resort.com>
X-Mailer: Apple Mail (2.3608.120.23.2.7)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/9j0ubK25d2AWnw7URtdwlVM-BEc>
Subject: Re: [Cbor] Reviews and shepherd for draft-ietf-cbor-cddl-more-control
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 11 Apr 2024 13:27:17 -0000

Hi Laurence,

thanks for following up on this.

I’ll answer about half of your message now (not in order), and the other half later.

> It would be nice if the cddl tool had a —version option so you could know easily what you have and put version dependency in document validation scripts. I wasn’t planning on updating the CDDL in the to-be-published EAT because you can’t error out saying “you need a new version of the cddl tool”.

I added a version number to the usage message in 0.11.3.

Generally,

   gem info cddl

…also gives you some information about which version of the tool you have installed.

The cddl tool will do the erroring out for you if you use an unimplemented control…

> I've done some work on this, mostly putting .b64u to work. Much is good and makes the CDDL neater and validation more thorough. The interesting one is validating https://github.com/ietf-rats-wg/eat/blob/master/cddl/Example-Tokens/deb.json

Ah, this is about describing the JWT by dividing it into its three parts, essentially a “split”-like usage of “.join”…

Hmm.

> 
> b64u should work on text strings, not just on byte strings.

Well, it accepts a text string as the target (left hand side), and a byte string as its controller (right hand side).
Do you have an example where you need something different?

(In a pinch, .cat can be used as a conversion operator between text and byte strings, but I’m not sure the tool is very smart about that.)

> In JWT, JSON-to-be signed is b64-encoded so we did the same in EAT. In deb.json, there are JSON-format Claims-Sets that are b64 encoded. The validation should be able to fully descend into them.

Yes, that is a useful objective.
.join is almost there.  You can write:

JWT-JWS = text .join ([
             b64u<jwt-headers>, ".",
             b64u<jwt-payload>, ".",
             b64u<jwt-signature>])
b64u<B> = text .b64u B
jwt-headers = text .json jwt-headermap
jwt-headermap = { * text => any } ; simplified
jwt-payload = bytes
jwt-signature = bytes

…except that, while generating example values is easy, validating against this is not that easy in general and therefore not yet implemented to a great extent in 0.11.3.

> The controller for .json names a CDDL group that can be arbitrarily complex CDDL, right? 

It is a CDDL type, and additionally its instances must be representable in JSON (this is not checked in a generic way by the cddl tool, though).

> Plaining to try out .join to validate the JWT message, a series of b64 strings separated by “.”.

> So far not sure what to make of the comment about complex use of .join and switching to ABNF.  Seems more like tool documentation than a standards. 

I think it is useful to mention that it is not easy to do a full implementation of this.

> Is there a second implementation of cddl validation?

Yes, but I’m not sure whether these follow the discussion about more-control very much at the moment.

Grüße, Carsten

Left for next mail:

> The wording in the draft for .b64u and friends should probably be more like standards language. For example:
> 
>     The target of .b64u MUST be a text string type
> 
>     The controller MUST be a byte string type (or a text string type)
> 
> Probably need to use “target” and “controller” in other places too.
> 
> All the members in the .join controller array must be text, right? It should say so.