Skip to content

Trailing bytes are accepted by msgpack@1, the envelope and the handshake #33

Open

Description

@Kinflou

MsgPack::decode (and, since #31, decode_seed) is rmp_serde::from_slice, which reads one value and never checks the rest of the input. So msgpack@1 accepts bytes with junk after the value. packed@1 and json@1 refuse them.

That leaves a gap in strictness between the official formats, in the reference itself. Every other runtime has to copy it to stay conformant, and a corrupted or concatenated frame body decodes silently.

Options:

  • Make msgpack@1 refuse trailing bytes, by checking that the reader is exhausted after the value, as Packed::decode_seed does. This is a behaviour change to a versioned format's decoder, so it needs a call under schema compatibility: stricter decoding of what no conformant writer produces.
  • Keep it, and state it in profiles/msgpack@1.json with a proving vector, so every runtime matches it deliberately rather than by accident.

Found while building runtime#29 stage 1 (#31).

Activity

  1. changed the title [-]msgpack@1 accepts trailing bytes after a value[/-] [+]Trailing bytes are accepted by msgpack@1, the envelope and the handshake[/+] on Oct 25, 2026
  2. Kinflou commented on Oct 25, 2026

    @Kinflou
    MemberAuthor

    The fuzz targets (#37) found the same gap in two more decoders, in both the Rust and TypeScript runtimes:

    • Envelope::decode reads [2, junk…] as a Fault, ignoring everything after the tag.
    • HandshakeFrame::decode reads only the first 31 bytes and ignores the rest.

    #37's framing_decode target treats these two as non-canonical by design for now: their re-encoding must be a prefix of the input. Every other binary frame has to re-encode exactly. The decision here covers all three: refuse trailing bytes (a vector change for every runtime), or state the leniency in the profiles with vectors that prove it.

  3. added
    1.0-blockerMust be done before the 1.0 announcement (docs conduct/readiness.md)
    P2Soon
    bugSomething isn't working
    wireFormats, framings, handshakes
    on Oct 31, 2026
  4. added this to the 1.0 milestone on Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    1.0-blockerMust be done before the 1.0 announcement (docs conduct/readiness.md)P2SoonbugSomething isn't workingwireFormats, framings, handshakes

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions