anweiss/cddl

Problem validating byte strings with .abnfb

stevenj opened this issue · 2 comments

I am having trouble validating byte strings with the .abnf RFC9165 extension.

This is my CDDL Definition:

; Binary ABNF Test Schema

test_cbor = {
  61285: sub_map
}

sub_map = {
  1: signature_abnf
}

signature = bytes .size 64

signature_abnf = signature .abnfb '
ANYDATA

ANYDATA = *OCTET

OCTET =  %x00-FF
'

Attached are the test case files.

Command I am running:

cddl validate --cddl abnf_test.cddl --cbor abnf_test.cbor

Using it as defined in these test files gives me:

[INFO] Root type for validation: test_cbor
[ERROR] Validation of "abnf_test.cbor" failed: error validating at cbor location /61285/1: unsupported data type for validating cbor, got '
ANYDATA

ANYDATA = *OCTET

OCTET =  %x00-FF
'

But I do not see any issue with the definition after reading the RFC many times.

If I replace signature_abnf in the sub_map with just signature the data validates.

hey @stevenj, thanks for reporting this. Your definition is indeed correct. Bug in the validation logic. Fixed in #191.

Fixed in #191