Re: [netmod] [core] CBOR YANG encoding of union & bits [draft-ietf-core-yang-cbor-12]

Michael Richardson <mcr+ietf@sandelman.ca> Wed, 06 May 2020 17:21 UTC

Return-Path: <mcr+ietf@sandelman.ca>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B60F43A0876; Wed, 6 May 2020 10:21:59 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=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 ONnvacFzY4Xi; Wed, 6 May 2020 10:21:57 -0700 (PDT)
Received: from tuna.sandelman.ca (tuna.sandelman.ca [209.87.249.19]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 773B83A0873; Wed, 6 May 2020 10:21:56 -0700 (PDT)
Received: from sandelman.ca (obiwan.sandelman.ca [IPv6:2607:f0b0:f:2::247]) by tuna.sandelman.ca (Postfix) with ESMTP id 7B4D83818F; Wed, 6 May 2020 13:19:25 -0400 (EDT)
Received: from localhost (localhost [IPv6:::1]) by sandelman.ca (Postfix) with ESMTP id B7FE68C; Wed, 6 May 2020 13:21:24 -0400 (EDT)
From: Michael Richardson <mcr+ietf@sandelman.ca>
To: Carsten Bormann <cabo@tzi.org>, "netmod@ietf.org" <netmod@ietf.org>, "core@ietf.org" <core@ietf.org>
In-Reply-To: <D66596CE-7F5C-4562-89A4-48FCE96D0E18@tzi.org>
References: <BY5PR11MB4355C26250C9CF46713C9956B5A40@BY5PR11MB4355.namprd11.prod.outlook.com> <D66596CE-7F5C-4562-89A4-48FCE96D0E18@tzi.org>
X-Mailer: MH-E 8.6+git; nmh 1.7+dev; GNU Emacs 26.1
X-Face: $\n1pF)h^`}$H>Hk{L"x@)JS7<%Az}5RyS@k9X%29-lHB$Ti.V>2bi.~ehC0; <'$9xN5Ub# z!G,p`nR&p7Fz@^UXIn156S8.~^@MJ*mMsD7=QFeq%AL4m<nPbLgmtKK-5dC@#:k
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-="; micalg="pgp-sha512"; protocol="application/pgp-signature"
Date: Wed, 06 May 2020 13:21:24 -0400
Message-ID: <28486.1588785684@localhost>
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/bzL-wLSKyTWRxxVAafiwyyhIqB0>
Subject: Re: [netmod] [core] CBOR YANG encoding of union & bits [draft-ietf-core-yang-cbor-12]
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 06 May 2020 17:22:01 -0000

Carsten Bormann <cabo@tzi.org> wrote:
    >> Or, if it is supported by the language then is it reasonable that
    >> implementation SHOULD support it?  In which case I think that we might
    >> need a second encoding of bits that supports this pathological case.
    >> Perhaps an array of 'set' bit positions, or alternatively the union
    >> string encoding of bits could be used.

    > This could reduce the attack vector by malicious YANG specification,
    > but I think an arbitrary limit (such as the 256 mentioned above) should
    > work, too.  (Except that arbitrary limits always come back to bite you,
    > but that’s what we have software maintenance contracts for.)

I think that the YANG knows what the maximum value is.
So I think that anyone generating code from specific YANG definitions could
size their array based upon that value.
If it's a generic decoder for YANG encoded content, then it might need
a hint from the application, or it could have a compile-time arbitrary limit.

--
Michael Richardson <mcr+IETF@sandelman.ca>, Sandelman Software Works
 -= IPv6 IoT consulting =-