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

Anders Rundgren <anders.rundgren.net@gmail.com> Wed, 20 March 2024 11:14 UTC

Return-Path: <anders.rundgren.net@gmail.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 01730C1654EC for <cbor@ietfa.amsl.com>; Wed, 20 Mar 2024 04:14:24 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.105
X-Spam-Level:
X-Spam-Status: No, score=-2.105 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, FREEMAIL_FROM=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
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
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 spB87sdmpUEV for <cbor@ietfa.amsl.com>; Wed, 20 Mar 2024 04:14:18 -0700 (PDT)
Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) (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 E296DC15109A for <cbor@ietf.org>; Wed, 20 Mar 2024 04:13:53 -0700 (PDT)
Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2d49f7e5d65so44377331fa.2 for <cbor@ietf.org>; Wed, 20 Mar 2024 04:13:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710933232; x=1711538032; darn=ietf.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=8iCB9IdHS9HyI8r2M8/fE4irVX+esTVp8OKT9dO9nso=; b=Fx00quy9cUtxAGZi6+5MsETJIzZa8+wDgplyTXv0m8xgpdZ23JZGN3eJqc5Oygj5gy cMXEMDOXz3nkH8rbsKT4GSqgM/Y49Em9lz/Kzpm1uVWhLT3o7KpkKBVD9Rg/iM4cIeNA cy8OVeuIvHGzNODI2skfVZOak7JoDTLPEITUTuMxjWJKhFispHysecQpO7rX8ODlnb31 J/kNr61SK4q5vt5JhRMTrnYrVLvBgruU+zFhlGmpt28Dm1awNYMsaG6W3cm3Q4D0LMcM x5MupMuljJxqC6CGzoBnvxVOPUAKbE+4w8Smjo9dmq1sYCe1iGonQaIrWsz+xG3JnOuA YKuQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710933232; x=1711538032; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8iCB9IdHS9HyI8r2M8/fE4irVX+esTVp8OKT9dO9nso=; b=jTyzDQQIFiltvOQjHDjZdVOrYgeRN9m+R1H8p+znXUFq0e0zcuQVwoI7OIvOfvGOF5 fppIqP3Qvf09nCikhh3MyaVrGqXBNyWH2wQR1hiKEHF4oaj8/6cOKXhFppZCeGEZO5WZ MBq3OGpQWdk/Zeyj3mkIBpQQDtSFqvc3ucEuwAvGxp4EZQdqM2Kz5owfwU2i5NMjS1sT Y7Kh1sZVIyo7LjDIs7/y+/bA+H2YOr5k4K4CPSfrW18OiFEpp1lZpqQLdEeeiJ4NjyTM F+52FFZ1L3oPvPX94biKuHthDZice6Y/R/+SJFI6w59xlwZjNjcx/yGP7RxwvwDPdaKa LAYg==
X-Gm-Message-State: AOJu0YxK/0RF7Mc6RFoLDOwJoBZJ7NJttQ9ogOgBr/QDPIc0F+fmkAZe YaIIJ6SwaymSZXKEOlHSK9bA+EHfogbMp/oTR0ppcLk3EJNtkqlMIaEuxS9d
X-Google-Smtp-Source: AGHT+IFWVkhjWDj4RtUAquCP1MgpRKHHeEwuy81I5ffcIfyA+hLyw/lN4+ELPgiTzPJYr4TTUIHHJQ==
X-Received: by 2002:a2e:8415:0:b0:2d4:6aba:f1a9 with SMTP id z21-20020a2e8415000000b002d46abaf1a9mr1189723ljg.40.1710933231606; Wed, 20 Mar 2024 04:13:51 -0700 (PDT)
Received: from ?IPV6:2a01:e0a:e1b:64b0:7c4c:5748:c901:3778? ([2a01:e0a:e1b:64b0:7c4c:5748:c901:3778]) by smtp.googlemail.com with ESMTPSA id e13-20020a05600c4e4d00b004146750314csm1937348wmq.3.2024.03.20.04.13.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Mar 2024 04:13:50 -0700 (PDT)
Message-ID: <fbdc5ac1-835f-4647-a8db-bd7df2251448@gmail.com>
Date: Wed, 20 Mar 2024 12:13:49 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-US
To: "lgl island-resort.com" <lgl@island-resort.com>, Henk Birkholz <henk.birkholz@ietf.contact>
Cc: "cbor@ietf.org" <cbor@ietf.org>
References: <8C245824-1990-4616-AB70-FFD4FACB1AE9@island-resort.com> <49eed1ea-f6d7-bb8c-adfa-a0943f715bb2@ietf.contact> <8CF69AD8-BF27-4078-B4C2-AE08F649C3B5@island-resort.com>
From: Anders Rundgren <anders.rundgren.net@gmail.com>
In-Reply-To: <8CF69AD8-BF27-4078-B4C2-AE08F649C3B5@island-resort.com>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/BeCnCfDYfDbNC-GP5TTbG0oM_CM>
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: Wed, 20 Mar 2024 11:14:24 -0000

IMO, the core problem is the idea with "application profiles".  There are many reasons to why applications and tools only use respectively support subsets of CBOR.

Making map labels generic is a no-issue in high-level, object-oriented, memory-hungry tools like my Java and JavaScript CBOR implementations.  Such tools BTW, have no reason to ever encode anything but EDN in the same way as the Blockchain Commons tools only encode dCBOR.

QCBOR was obviously designed for memory-constrained embedded systems. This comes with certain limitations that are perfectly valid for the intended targets.  However, adding support for dCBOR in QCBOR seems a bit problematic since Gordian Envelopes require CBOR data items to be represented as discrete objects that can be added, moved, deleted, and replaced.

Anders

On 2024-03-19 19:19, lgl island-resort.com wrote:
> Henk, No worries for QCBOR users. There has been a warning in the documentation since its early beginnings.
> 
> Don’t want to make this about QCBOR, but a comment. QCBOR has explicit support to make maps easier to work with. It automatically decodes into one item with label and value and you can search a decoded map by label. Would be hard to have a clean/small design and support arbitrarily complex labels. Never a complaint.
> 
> It also has a mode that can handle arbitrary labels at the cost of the nicer map handling features.
> 
> LL
> 
> 
>> On Mar 17, 2024, at 5:35 PM, Henk Birkholz <henk.birkholz@ietf.contact> wrote:
>>
>> Hi Laurence,
>>
>> Why are map labels special here?
>> Or does your comment imply that dCBOR relies on a "symmetric" dJSON?
>>
>> More comments in-line.
>>
>> On 17.03.24 19:41, lgl island-resort.com wrote:
>>> A CBOR map label (aka map key) can be any data type including perverse things like an array or a map. Here’s a sample I made for dCBOR testing:
>>
>> "perverse"
>>
>>>      {[]: 7, 1(88): 2, "text": 3, 1: 1, {}: 4, h'7878': 5, true: 6, 8.77: 7}
>>> It has a map label of each major data type.
>>> Probably dCBOR should disallow map labels that are not strings or numbers because they don’t translate to JSON. Same reason simple type undef is disallowed.
>>> Probably we should state a general CBOR preference that map labels only be strings and integers.  QCBOR only supports text/byte strings and integers for map labels.
>>
>> It is not an implementation of RFC9254 then. Maybe that should be noted somewhere.
>>
>>> It’s been like this for years now and I’ve had no comment or request. Probably any use case that considers unusual labels can be redesigned to avoid them.  We only state a preference, not a prohibition, just like with indefinite lengths.
>>
>> For a while, arrays where (considered and tested) as map keys in suit-manifests. Again, if you do not want to implement RFC9254, please set up some warning signs.
>>
>>> LL
>>
>> Viele Grüße,
>>
>> Henk
>>
>>> _______________________________________________
>>> CBOR mailing list
>>> CBOR@ietf.org
>>> https://www.ietf.org/mailman/listinfo/cbor
> 
> _______________________________________________
> CBOR mailing list
> CBOR@ietf.org
> https://www.ietf.org/mailman/listinfo/cbor