Re: [Cbor] CDDL parsing questions

Derek Atkins <derek@ihtfp.com> Thu, 18 August 2022 23:27 UTC

Return-Path: <derek@ihtfp.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 9BAF5C14CE47 for <cbor@ietfa.amsl.com>; Thu, 18 Aug 2022 16:27:01 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.108
X-Spam-Level:
X-Spam-Status: No, score=-2.108 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, 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 (1024-bit key) header.d=ihtfp.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 PMqIhOWEIbzu for <cbor@ietfa.amsl.com>; Thu, 18 Aug 2022 16:26:57 -0700 (PDT)
Received: from mail2.ihtfp.org (MAIL2.IHTFP.ORG [204.107.200.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2DA92C14F726 for <cbor@ietf.org>; Thu, 18 Aug 2022 16:26:57 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1]) by mail2.ihtfp.org (Postfix) with ESMTP id DC7BAE203A; Thu, 18 Aug 2022 19:26:55 -0400 (EDT)
Received: from mail2.ihtfp.org ([127.0.0.1]) by localhost (mail2.ihtfp.org [127.0.0.1]) (amavisd-maia, port 10024) with ESMTP id 22915-06; Thu, 18 Aug 2022 19:26:54 -0400 (EDT)
Received: by mail2.ihtfp.org (Postfix, from userid 48) id CE3E5E203F; Thu, 18 Aug 2022 19:26:54 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ihtfp.com; s=default; t=1660865214; bh=XtixHMejnRLTFBflk1cjjiNMIq/IP6bSOS48U1haIg4=; h=In-Reply-To:References:Date:Subject:From:To:Cc; b=GfYu+srgSUYYIKB54t3gIUbhg0H6peML95QbNlBDUwOjR3EU4pn+dWYSGxVbqQ2L5 miSHOI28mdAg+yLtAyly5IUw/dncB08yA6i+/NHIHVJtdr1lrE94TR/vKvHbcaSi7d NrtmthN47L9YbGx4QHV74fIz48EGLiwxC+XkPesE=
Received: from 192.168.248.239 (SquirrelMail authenticated user warlord) by mail2.ihtfp.org with HTTP; Thu, 18 Aug 2022 19:26:54 -0400
Message-ID: <6116161e782da9bfaa7b536fa54effd3.squirrel@mail2.ihtfp.org>
In-Reply-To: <c8401332-6d01-c982-599f-ac85beac8c47@gmail.com>
References: <Yv13HuFndByI/TtZ@faui48e.informatik.uni-erlangen.de> <2d9abb4cff288213ee021bfb5d57f5a6.squirrel@mail2.ihtfp.org> <57a7223d-62d8-1d51-1db3-9c5e37d07117@gmail.com> <b840079bee9919557ceeaaf515f9c26e.squirrel@mail2.ihtfp.org> <c8401332-6d01-c982-599f-ac85beac8c47@gmail.com>
Date: Thu, 18 Aug 2022 19:26:54 -0400
From: Derek Atkins <derek@ihtfp.com>
To: Brian E Carpenter <brian.e.carpenter@gmail.com>
Cc: cbor@ietf.org, Toerless Eckert <tte@cs.fau.de>
User-Agent: SquirrelMail/1.4.22-14.fc20
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
X-Priority: 3 (Normal)
Importance: Normal
X-Virus-Scanned: Maia Mailguard 1.0.2a
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/5Uvy62X-owrnMH4ucpFbKZYwSkM>
Subject: Re: [Cbor] CDDL parsing questions
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, 18 Aug 2022 23:27:01 -0000

Brian,

On Thu, August 18, 2022 7:15 pm, Brian E Carpenter wrote:
> On 18-Aug-22 23:32, Derek Atkins wrote:
>>
>>
>> On the other hand, if you see a CBOR object that decodes to:
>>
>> {
>>    1:  "foo",
>>    2:  "bar",
>>    3:  "baz"
>> }
>>
>> --- what does this mean?   You need to know what '1', '2', and '3',
>> mean.
>> Yes, the CDDL can tell you, but that assumes you're being sent the
>> object
>> you expect.
>
> And if you don't know what '3' means, should you ignore it (Postel
> principle)
> or throw an error (draft-iab-protocol-maintenance)?

Well, it depends on the underlying protocol.  You could have a map
defined as:
{
  1 : tstr,
  2 : tstr,
  ?int : tstr
}

Which means the 3: "baz" is allowed...  So yes, what do you do if you
don't know what '3' means?

Even with CDDL, however, if defined like it is above, you still don't have
an answer to that question.

-derek

-- 
       Derek Atkins                 617-623-3745
       derek@ihtfp.com             www.ihtfp.com
       Computer and Internet Security Consultant