Skip to content

fix: compile-time key ordering validation in CborSerialize/CborDeserialize#11

Merged
mingweishih merged 1 commit intoAzure:mainfrom
mingweishih:macro-audit
Apr 17, 2026
Merged

fix: compile-time key ordering validation in CborSerialize/CborDeserialize#11
mingweishih merged 1 commit intoAzure:mainfrom
mingweishih:macro-audit

Conversation

@mingweishih
Copy link
Copy Markdown
Contributor

@mingweishih mingweishih commented Apr 17, 2026

Add validation in parse_fields() that #[cbor(key = N)] values are strictly ascending and unique. Out-of-order or duplicate keys now produce clear compile errors citing RFC 8949 §4.2.1.

This prevents silently generating non-deterministic CBOR maps.

Description

Related Issues

Checklist

  • I have read the CONTRIBUTING guidelines
  • All new source files include the Microsoft copyright header
  • New public APIs have doc comments
  • Tests have been added or updated
  • cargo test --all passes
  • cargo fmt --all -- --check passes
  • cargo clippy --all -- -D warnings passes

…alize

Add validation in parse_fields() that #[cbor(key = N)] values are
strictly ascending and unique. Out-of-order or duplicate keys now
produce clear compile errors citing RFC 8949 §4.2.1.

This prevents silently generating non-deterministic CBOR maps.
@mingweishih mingweishih merged commit 5d4d3be into Azure:main Apr 17, 2026
7 checks passed
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.

2 participants