Skip to content

Fix field order for structs in ctap2::get_info to produce canonical CBOR#76

Open
robin-nitrokey wants to merge 2 commits into
mainfrom
canonical
Open

Fix field order for structs in ctap2::get_info to produce canonical CBOR#76
robin-nitrokey wants to merge 2 commits into
mainfrom
canonical

Conversation

@robin-nitrokey
Copy link
Copy Markdown
Member

As pointed out in #75, some of our structs do not produce canonical CBOR when serialized with cbor-smol because of a wrong field order. This PR adds tests for all structs that implement Serialize to ensure that they produce canonical CBOR and fixes the field order for the CtapOptions and Certifications structs in ctap2::get_info. Structs using serde_indexed::SerializeIndexed are not tested explicitly because serde-indexed v0.1.1 automatically uses the correct field order.

cc @0x0ece

This patch makes sure that all structs use the canonical CBOR encoding
as defined and required by § 8 Message Encoding of the CTAP
specification [0].

Structs using serde_indexed::SerializeIndexed are not tested because
in serde-indexed v0.1.1, the correct order is automatically enforced.

[0] https://fidoalliance.org/specs/fido-v2.2-ps-20250714/fido-client-to-authenticator-protocol-v2.2-ps-20250714.html#message-encoding
This patch fixes the field order of the CtapOptions and Certifications
struct so that we produce canonical CBOR when serializing them with
cbor-smol.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant