[Cbor] Tagging requirement

Laurence Lundblade <lgl@island-resort.com> Mon, 17 August 2020 05:09 UTC

Return-Path: <lgl@island-resort.com>
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 9E4DB3A0948 for <cbor@ietfa.amsl.com>; Sun, 16 Aug 2020 22:09:44 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.896
X-Spam-Level:
X-Spam-Status: No, score=-1.896 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=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 HL1U2wPBorlU for <cbor@ietfa.amsl.com>; Sun, 16 Aug 2020 22:09:43 -0700 (PDT)
Received: from p3plsmtpa08-02.prod.phx3.secureserver.net (p3plsmtpa08-02.prod.phx3.secureserver.net [173.201.193.103]) (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 A9A3E3A08CB for <cbor@ietf.org>; Sun, 16 Aug 2020 22:09:43 -0700 (PDT)
Received: from [192.168.1.49] ([76.167.193.86]) by :SMTPAUTH: with ESMTPA id 7XOwkVlEEccZp7XOxkxxB2; Sun, 16 Aug 2020 22:09:43 -0700
X-CMAE-Analysis: v=2.3 cv=c/HVvi1l c=1 sm=1 tr=0 a=t2DvPg6iSvRzsOFYbaV4uQ==:117 a=t2DvPg6iSvRzsOFYbaV4uQ==:17 a=IkcTkHD0fZMA:10 a=4x9wB5P1pbMlZxtjjd8A:9 a=QEXdDO2ut3YA:10
X-SECURESERVER-ACCT: lgl@island-resort.com
From: Laurence Lundblade <lgl@island-resort.com>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\))
Message-Id: <5F695632-CF27-40FF-BC23-E731AAA95771@island-resort.com>
Date: Sun, 16 Aug 2020 22:09:42 -0700
To: cbor@ietf.org
X-Mailer: Apple Mail (2.3608.80.23.2.2)
X-CMAE-Envelope: MS4wfBoUdDYL/daN6tTTWjL7tNd4hddqqL/NN4IbiAcCjU4s3Iv4NT6yQccPXwlSjYM3btSp+0b9yhaWD0uQQGHO7cS/mlWtldDU9RP9ETM+Zfw04NS8kKw8 zNnHWs0ckgcv7rEyhANlPkLnbE85z7gS2PDM7t9KS7U9yCXVS6sm4kAK
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/nMytlA7OkBkujQT2f4m83wgEQpk>
Subject: [Cbor] Tagging requirement
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
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: Mon, 17 Aug 2020 05:09:45 -0000

My understanding is that the surrounding protocol that uses a tagged type dictates whether the tag should be present or not. For example, CWT dictates that tag 1 (epoch time) must not be used for the “exp”, “nbf” and “iat" claims.

So the surrounding protocol can pick one of these three when it use a tagged type.
 - Tag is FORBIDDEN (e.g., date fields in CWT). Decode error if tag is present.
 - Tag is REQUIRED tags (e.g., COSE type tag when CWT tag is present). Error occurs if tag is absent, probably because item is not of the expected type.
 - Tag is OPTIONAL (e.g., application/cwt and the CWT tag). Maybe an error, maybe not. 

As far as I can see there isn’t a clear rule about which of these it is when the surrounding protocol doesn’t explicitly pick. Deterministic encoding does disallow OPTIONAL. If I were to guess as to which is the default, I would say it is OPTIONAL.

Big floats and decimal fractions make use of the bignum type, but the definition of big floats and decimal fractions doesn’t explicitly say which of the three above it selects, so one might think it is OPTIONAL if one assumes that is the default of the three and that you could distinguish a bignum mantissa because it is a byte string not an integer. One second though, you realize you can’t tell the sign of the bignum unless there is a tag so it has to be REQUIRED to work.


My thought is that OPTIONAL adds no value.  It is a form of “be liberal in what you receive” that seems to be less in favor these days. When you nest tagged type usage with OPTIONAL, you can get a larger fan out.  However, OPTIONAL is allowed in 7049 and things like the application/cwt media type registry use it.

My thought is that it would be helpful to say somewhere that users of tagged types should explicitly say what the tagging requirement is and should avoid OPTIONAL tagging.

(I came to this trying to write code for tag handling for big float, EAT, CWT, COSE and such. I’m trying not to be annoying, but also think this is an issue :-) )

LL