The green checkmark that lied

Two services stared at the same map and disagreed about everything that mattered. Same integer. Same text string. Same two members. Both encoders emitted valid CBOR, both decoders read it back cleanly, and the signature check failed anyway — because one encoder had picked a longer-but-perfectly-legal argument width and written its keys in insertion order, while the other had used shortest forms and sorted them. The value was identical. The bytes were not. Somewhere between the two sat a rule the protocol designer had imagined, relied on, and never written down.

That unwritten rule now has a number and a working-group last call. draft-ietf-cbor-serialization-08, dated 29 July 2026, is an active CBOR working-group Internet-Draft; the Datatracker still records the IESG state as I-D Exists. It is work in progress — not a final RFC, and not evidence that any shipping product implements a word of it. Its practical value is sharper than that: it hands protocol authors names for three different serialization contracts, then asks them to assign the right one exactly where bytes start to have consequences.

CBOR is both a data model and a family of encodings, and one decoded value can survive several legal byte representations. That flexibility is a gift to streaming, constrained devices and the installed base. It becomes a landmine the moment a downstream system treats one representation as if it were the only one.

Three serialization contracts: general, preferred-plus and deterministic CBOR

General serialization is the theoretical default when a CBOR-based protocol says nothing else. For every type it supports, a conforming decoder is expected to accept all encodings CBOR permits, including definite and indefinite lengths. That is a broad interoperability promise — and the draft makes an awkward operational observation about it: such breadth is not widely implemented. A specification can invoke the general set while deployed decoders quietly accept a much smaller language.

Preferred-plus serialization narrows encoder freedom. Arguments use their shortest form; floating-point values use the shortest representation that preserves the value exactly; lengths are definite; NaN handling follows the stated trivial representation; integers and bignums are normalized as specified. It aims to be the practical common choice for most protocols. Crucially, it does not require map sorting.

Deterministic serialization takes preferred-plus and adds one rule: map items are ordered by the bytewise lexicographic order of the deterministic encodings of their keys. Independent conforming encoders given the same model value can therefore converge on the same bytes — provided the surrounding protocol has already removed the remaining ambiguities about what the value means.

These sets are nested in permitted output, but they are not a moral ranking. General serialization preserves capabilities some designs genuinely need: indefinite-length construction, a meaningful distinction between integers and bignums, non-trivial NaN payloads. Deterministic serialization deliberately deletes those choices. Selecting it is an interoperability decision, not a declaration that every other legal encoding is defective.

The decoder boundary matters just as much. Deterministic decoding imposes no requirements beyond preferred-plus decoding. A deterministic encoder produces a restricted form, but a receiver is not thereby instructed to reject every non-deterministic input unless the end-to-end protocol separately demands that rejection. "We emit deterministic CBOR" and "we accept only deterministic CBOR" are two different controls with two different compatibility bills.

Do the bytes travel, or are they rebuilt?

The fastest way to choose a serialization contract is to follow the protected bytes.

If a sender signs a CBOR payload and transmits those exact payload bytes alongside the signature, the receiver can verify the bytes it received. It need not decode the value and recreate an identical serialization first. The draft uses COSE payload handling as the intuitive case. Hashing and signatures do not automatically require deterministic serialization; they require both sides to agree on the byte string the cryptographic operation actually covers.

Everything changes when each party constructs that byte string independently. A COSE Sig_structure is assembled by the signer and again by the verifier from agreed fields. If their encoders can choose different legal representations, equal model values yield unequal signature inputs. The same risk surfaces in content addressing, cache keys, deduplication, reproducible manifests and byte-level equality checks. Here determinism is not aesthetic tidiness. It is the missing agreement that makes independent reconstruction possible at all.

This single test prevents two opposite mistakes. One team imposes map sorting and shortest forms on every payload, paying migration cost for a design that already carries the exact protected bytes. Another team chants "CBOR is interoperable" while independently rebuilding signature input with whatever the library defaults happen to be this quarter. The right question is neither "Is cryptography involved?" nor "Is this CBOR valid?" It is: which exact bytes must two independent processes obtain, and where is that obligation written down?

Determinism is local. A deterministic requirement for Sig_structure does not automatically govern an embedded payload, an outer envelope or every field someone adds next year. Protocol text should name the byte-producing boundary precisely. Otherwise one small rule quietly becomes platform policy, and later implementers cannot tell which deviations actually break interoperability.

Sorting a CBOR map does not give the map an order

CBOR maps are unordered in the generic data model. Deterministic serialization sorts their encoded keys to select one byte layout. That does not promote the chosen layout into business sequence, display priority or processing order.

Forgetting this is easy, because packet tools draw keys in a line. A developer iterates the decoded map and assumes the first key should win. Another runtime preserves insertion order, a third retains encoded order, a fourth uses a hash table. All four decode the same CBOR value. If an application needs precedence, it must model precedence explicitly — through an array, a priority field, some specified structure — not borrow it from the serializer.

Key sorting does not complete the data model either. The protocol must still define allowed key types, tags, duplicate-key behavior, schema evolution, equivalence rules and the treatment of unknown fields. Preferred-plus happens to yield a deterministic result when no maps are present, but that fact settles nothing about whether two tagged values are equivalent or whether a missing member changes authorization.

Byte equality can be stricter than semantic equality. Two encodings may represent values an application considers equivalent while a byte comparison rejects them. Semantic equality can also be dangerously vague: Unicode normalization, numeric domains, tag interpretation and application defaults all differ. Deterministic CBOR chooses bytes after the model has been chosen. It cannot choose the model on the protocol's behalf.

Treat the word "canonical" with care. Different profiles deliberately choose different restrictions. The separate deterministic CBOR application profile in draft-mcnally-deterministic-cbor-17 narrows CBOR further; its rules must not be silently attributed to the working-group draft. Say which profile and which revision applies. A generic claim of "canonical CBOR" conceals exactly the interoperation contract an audit needs to see.

A valid signature is a byte receipt, not an authorization

When deterministic reconstruction succeeds and a signature verifies, the receipt means something real: a named algorithm under a named key protected a defined byte sequence. That is stronger than a log line saying two decoded objects looked alike. It is still not an authorization decision.

The signature does not prove the schema admitted every fact relevant to the decision. It does not prove a tag was permitted in this context, a timestamp was current, an issuer still held authority, an optional field was not omitted, or a duplicate key was resolved safely. It does not say a verified request may spend funds, change routing policy or modify an account. It does not observe whether the approved operation later happened.

Keep the layers separately receipted: the information model; the CBOR data model; the serialized byte string; cryptographic verification; schema and semantic validation; local policy; authorization; attempted execution; observed effect. A green indicator at one layer cannot inherit evidence from the next.

CDDL helps describe CBOR data shape. The serialization-control mechanism discussed in the draft can state a serialization requirement alongside such a description. Useful coordination — but a schema is not running code, and it is not a grant of authority. A CDDL match cannot show which library version parsed the message, which duplicate-key policy ran, which trust anchor was selected or which state transition committed.

COSE and CWT illustrate the division of responsibility. A framework can support many end-to-end protocols and cannot know every application's reconstruction or streaming needs. Where the framework does not force a set, the draft recommends preferred-plus, while the incorporating protocol states the actual serialization requirements. Library defaults cannot safely stand in for that decision. Defaults change; wrappers hide them; language bindings expose different switches.

The decoder gap is part of the deployment contract

The general set's theoretical breadth creates a practical trap. Procurement language says "supports CBOR" while one decoder rejects indefinite strings, another rejects legal alternate widths, and a third happily accepts inputs the system never tests. A standards label then substitutes for an observed acceptance matrix.

Running-code evidence needs exact artifacts: library and version, build flags, encoder mode, decoder options, schema revision, input value, emitted bytes, accepted variants, rejected variants and downstream result. Golden vectors should cover both the happy deterministic output and the boundaries the deployed receiver claims to accept. Differential tests should push the same corpus through every implementation that participates in the protocol.

Negative tests matter more than the happy path. Feed an alternate but legal general encoding to a component that claims general decoding. Feed a non-shortest form to a preferred-plus gate. Swap map insertion orders while preserving value. Exercise integer/bignum boundaries, definite and indefinite lengths, floating-point width and NaN behavior. Record not only parser acceptance but the value the application received and the policy path that followed.

An encoder conformance test cannot prove decoder breadth. A decoder acceptance test cannot prove the system emits deterministic bytes. A round trip through one library can conceal both failures, because the same implementation keeps repeating its own assumptions back at itself. Interoperability evidence begins the moment independently built paths meet.

NaNs, bignums and indefinite lengths: where "same value" gets slippery

Floating-point handling is where a "same value" claim starts to slide. Preferred-plus asks for the shortest exact representation and prescribes the trivial quiet NaN form. Yet NaNs can carry payload bits, and some applications distinguish or preserve them. A protocol that needs non-trivial NaNs cannot simply declare deterministic serialization and hope the information survives the trip.

Likewise, a data model that distinguishes a bignum from an ordinary integer may need general serialization rather than normalization. Streaming systems may depend on indefinite-length construction because the final size is unknown when transmission begins. These are legitimate requirements. They should produce an explicit special serialization contract — not an undocumented encoder exception that someone discovers in production.

The smallest shared rule is usually the most durable. Specify deterministic reconstruction only where independent byte equality is required. Use preferred-plus for ordinary exchange when its restrictions fit. Retain general, or a named special profile, where the application genuinely needs the extra representational choices. That is Minimum Initial Specification in practice: coordinate the minimum surface that must be common, and leave the local future decisions outside it.

Fewer legal encodings close one covert channel, not all of them

Multiple valid serializations can carry information that never appears in the decoded value. An encoder can vary argument widths, chunk indefinite-length items differently, or pick among other legal representations. A compromised component may use those choices as a covert channel while downstream software sees exactly the model value it expects.

Preferred-plus and deterministic rules shrink that freedom, and deterministic encoding makes unexpected byte variation conspicuous. It does not prove the absence of exfiltration. The attacker may choose among semantically allowed values, reorder data before it enters the model, manipulate timestamps, select tags, exploit padding in another layer, or leak through timing and traffic shape.

So record both the normalized model and the actual bytes at the trust boundary where appropriate, with retention and privacy controls attached. Alert when supposedly deterministic producers emit divergent bytes for the same frozen test corpus. Do not upgrade that test into the claim "no covert channel exists." It proves one thing only: this particular serialization degree of freedom was constrained in this particular execution.

Build a receipt that survives a library upgrade

A useful serialization receipt names the protocol and draft or RFC revision; the required set at each byte boundary; the CBOR data-model profile; allowed tags and key types; duplicate-key policy; encoder library, version and options; decoder library, version and accepted set; schema revision; original input; emitted bytes or a durable digest plus retrievable evidence; cryptographic input; key provenance; verification result; semantic validation; policy decision; authorization; attempted operation; observed effect.

It also records where exact bytes travel and where they are reconstructed. That one diagram frequently exposes the real defect. Teams discover that a proxy decodes and re-encodes a signed payload, that a cache hashes a parsed object, or that two services build a structure from fields with different default handling.

Ownership should be distributed rather than blurred. Protocol designers own the byte-boundary rule. Implementers own encoder and decoder evidence. Security engineering owns cryptographic and parser assurance. Application owners define semantics and equivalence. Policy owners define authorization. Operations prove the effect. A transaction identifier and a timestamp join the receipts without pretending they are one assertion.

Lu Heng's Running-Code Primacy asks what actually ran, not which label appeared in a design document. Reality Layers stops a deterministic byte string from borrowing the authority of a schema, or a signature from borrowing the authority of a business decision. The result is not scepticism about standards. It is a cleaner use of them.

Deterministic CBOR solves a precise problem: independent encoders need one byte sequence. It does not solve every problem located after decoding. The value can be the same while the bytes differ; the bytes can be identical while the meaning stays disputed; the meaning can be accepted while the action remains unauthorized. Good architecture keeps all three sentences available at once.

Sources