Re: [Cbor] Unusual map labels, dCBOR and interop

Orie Steele <orie@transmute.industries> Thu, 28 March 2024 03:36 UTC

Return-Path: <orie@transmute.industries>
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 2D32CC270EF6 for <cbor@ietfa.amsl.com>; Wed, 27 Mar 2024 20:36:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.095
X-Spam-Level:
X-Spam-Status: No, score=-7.095 tagged_above=-999 required=5 tests=[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_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=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 (2048-bit key) header.d=transmute.industries
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 Svf2mI6Xbta4 for <cbor@ietfa.amsl.com>; Wed, 27 Mar 2024 20:36:35 -0700 (PDT)
Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 0FB01C23D888 for <cbor@ietf.org>; Wed, 27 Mar 2024 20:36:35 -0700 (PDT)
Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-5e8470c1cb7so336990a12.2 for <cbor@ietf.org>; Wed, 27 Mar 2024 20:36:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=transmute.industries; s=google; t=1711596994; x=1712201794; darn=ietf.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=SQtPmpgSSeJ9wI8mEsvPXY2ariHZQDWyuWwrJyW/Wv0=; b=IbxmLSYstSFqdDDwHBH2uFAlgARorPddeetRGruDXziauRXRaJRmZ9tJPHzEa1Lqe7 c+HV1/6fl2ifIXxGw7ltHzL1mI6OULHxsfReg8Vq2Wukmt/uXX4GHpw+cR9YJNGGdvA6 ERKGIQmnqUF3nz/twUFRWoJ+EN05v8fujOkSfl98dNFqmv1hXt+awVgfiOV0v6yq0PDo Ck4C8R7SEnGPmZIlfi9ri/+dnduQLcJA9D8rORuBBvMcaYAATe/kje9PZ+Gs8OWt441Q 0fdRIWjRdDNgSKMoPKECaf+1/bkCCuW+wO19QLf03MSQYSqLOB/9XaPUYhBTGfiGroPw 5Jiw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711596994; x=1712201794; 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=SQtPmpgSSeJ9wI8mEsvPXY2ariHZQDWyuWwrJyW/Wv0=; b=MZO1aB7pkX37RcC5B6vpCLkJSkTRVotF1Ve6FHAc1PJvyGcWTHwzQuXeXpvLXh2+hY oqGxr4gYeNaAde4zFeEo1ajEusxFwhlcTAfBV0s48l8EVP5O4Xb4PTYx778Il/F4Z1Pg yR36xJJSuRnjp9yjRz8PO2BtpshYfE/nB76UoHm5S2XkRRBaF2hPAvJlu0Ajd4Yqr8Bp Ju+dIVXhafAJDoO8GAdUNQRI6hHCdK8nHRsN2Qbol4v4wgQtXxDO237XgD2cNmE5I1e3 htLJ38ly37uhPOS82IBIR7Nsqf9xDnlxadCPaYmacwUJA+V89dSf1Lxo34kwIa6XlcHZ vv/A==
X-Forwarded-Encrypted: i=1; AJvYcCV9QJkhmxLXt3r2/VFYD6bCO0ExU1qMUAI6bGWoVcGaWgKVhjbT2ZAHiV5RvHxbF9ViMbQWXLsvo4jW65kz
X-Gm-Message-State: AOJu0YxYoUr1DXA/pT2JdrDWpIZg8PEzXS989bfgt+x6iHtDLESuxqnL t4qRGwb6oVgv7D+uwONtxyJO+CkmyNMDEq6Up2IpEYh3979/RqCSeo0ao2TvOTWtXK7qmvwRJ8L RKJ78WclnOFTnLxAcm/fOSpdX7N2LIWpAn4u4W8gzs8uy2naX
X-Google-Smtp-Source: AGHT+IHmHOi1oI+nwH975H1wEkYz4aRDN4IgVtBfdvozoa3uMREm52c8oZ/Mi7PAfcHeb9ynjOVq8oEXbDJw8PqSQDw=
X-Received: by 2002:a05:6a20:9284:b0:1a3:6833:1cf5 with SMTP id q4-20020a056a20928400b001a368331cf5mr1596550pzg.29.1711596994002; Wed, 27 Mar 2024 20:36:34 -0700 (PDT)
MIME-Version: 1.0
References: <8C245824-1990-4616-AB70-FFD4FACB1AE9@island-resort.com> <11E8A8A5-D891-49FF-AF16-697C06F463B3@tzi.org> <9A0CE364-C141-4EBE-9703-292C416D12F5@island-resort.com> <3D62C4F0-D570-4EE4-AF6A-163C708AA6BE@tzi.org> <58BA8F8C-0C63-4534-9BF7-255C32D02C16@island-resort.com> <5F1E1133-4565-4D0A-98EE-A13C6F5F67AA@wolfmcnally.com> <CAN8C-_+72_H=mk6xGuSk72rZWVg9Ff0d_b_o8Rz+kRWn1FruCQ@mail.gmail.com> <E585B8F9-BA13-4018-8D50-3C7560183BC4@wolfmcnally.com>
In-Reply-To: <E585B8F9-BA13-4018-8D50-3C7560183BC4@wolfmcnally.com>
From: Orie Steele <orie@transmute.industries>
Date: Wed, 27 Mar 2024 22:36:21 -0500
Message-ID: <CAN8C-_JJZ6uS5mBj_gNozC7H3+RG7ULBJ6gO55R9B7=gv=D_RA@mail.gmail.com>
To: Wolf McNally <wolf@wolfmcnally.com>
Cc: "lgl island-resort.com" <lgl@island-resort.com>, Carsten Bormann <cabo@tzi.org>, cbor@ietf.org, Christopher Allen <christophera@lifewithalacrity.com>, Shannon Appelcline <shannon.appelcline@gmail.com>
Content-Type: multipart/alternative; boundary="000000000000d39ad60614b03a30"
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/QUpIO3ZG3w0rdyCXq7xEN796Nqo>
Subject: Re: [Cbor] Unusual map labels, dCBOR and interop
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, 28 Mar 2024 03:36:39 -0000

(with no hat)

Set size comparison, and equivalence is key to distinguishing types in
mathematics.

The set of valid application/cbor instances is strictly larger than the set
of application/dcbor (or whatever) instances.

This exact property is what makes dcbor useful especially in the context of
unique digests for a given serialized data structure.

If undefined were encountered when deserializing dcbor to JavaScript, an
error should be thrown?

SCITT Receipts and CWTs are built on the assumption that no error would be
thrown.

I must have not understood the comment made regarding map labels, because I
thought you were saying that dcbor serializes maps differently from vanilla
CDE... If it doesn't, why the need for any new serialization?

I don't think dcbor can be called application/cbor any more than json
without booleans can be called application/json.

Processors not expecting Booleans in JSON would explode, and processors of
dcbor expecting it to be meaningfully different than application/cbor will
also explode right?

Feeding unexpected content to a parser is the normal expectation for
security formats.

We've seen real problems arise from JSON-LD, being valid json, but not
quite valid "JSON-LD"... It can lead to ambiguous processing, where some
middle boxes throw errors and others don't.

Distinguishing dbcor from cbor seems a prerequisite to making any progress
on its application in a security context.

OS











On Wed, Mar 27, 2024, 9:42 PM Wolf McNally <wolf@wolfmcnally.com> wrote:

> Orie,
>
> > On Mar 27, 2024, at 6:57 PM, Orie Steele <orie@transmute.industries>
> wrote:
> >
> > Using deterministic encoding to serialize map keys is interesting.
> >
> > I wonder about security issues with distinguishability.
> >
> > Consider the case where a map has keys that are serialized with and
> without deterministic encoding.
>
> Map keys in dCBOR are themselves part of the dCBOR serialization and must
> therefore also conform to dCBOR.
>
> >
> > Restricting map keys, reminds me of another flavor of CBOR, I think it
> was called dag-cbor, it required all map keys to be tstr... Whereas dCBOR
> requires them all to be bstr?
>
> No, the handling of map keys as serialized dCBOR strings internally is a
> detail of our reference implementation. dCBOR map keys are simply
> serialized as dCBOR items like every other dCBOR item— they are not
> segregated into typed byte strings. So the map:
>
> {[1, 2, 3]: "Hello”}
>
> Is serialized as:
>
> A1               # map(1)
>    83            # array(3)
>       01         # unsigned(1)
>       02         # unsigned(2)
>       03         # unsigned(3)
>    65            # text(5)
>       48656C6C6F # "Hello"
>
> Not as:
>
> {h'83010203': "Hello”}
>
> A1               # map(1)
>    44            # bytes(4)
>       83010203   # "\x83\u0001\u0002\u0003"
>    65            # text(5)
>       48656C6C6F # "Hello"
>
> > Is it critical to assign unique media types in order for deserialization
> to succeed?
>
> No, for the reasons stated above.
>
> > I also wonder about interactions with COSE and related protocols
> especially regarding unprotected headers.
>
> COSE is not necessarily dCBOR, although you can certainly encode COSE in
> compliance with dCBOR. And for particular applications you can certainly
> state that any of the signed byte strings in the protected header or
> payload must conform to dCBOR, which would help ensure determinism. For
> example, the payload could be a serialized Gordian Envelope, which is a
> format that supports verifiable claims based on dCBOR. We at Blockchain
> Commons are considering proposing the inclusion of Gordian Envelope as a
> Verifiable Data Structure for inclusion in the COSE Receipts registries.
>
> https://datatracker.ietf.org/doc/draft-mcnally-envelope/
>
> ~ Wolf