Skip to content

Reject extra values on single-valued key-package tags #241

@erskingardner

Description

@erskingardner

Summary

Key-package tag validation currently accepts extra trailing values on tags that are intended to be single-valued.

This is not newly introduced behavior, but it is worth tightening as a protocol-compliance follow-up.

Current behavior

In crates/mdk-core/src/key_packages.rs, validation for single-valued tags such as:

  • mls_protocol_version
  • mls_ciphersuite

extracts the value at index 1 and ignores any additional elements.

That means tags like these are currently accepted:

  • ["mls_protocol_version", "1.0", "junk"]
  • ["mls_ciphersuite", "0x0001", "junk"]

while the i tag already enforces an exact single-value shape.

Why this matters

For tags that are semantically single-valued, accepting extra values makes validation looser than necessary and can allow malformed events to pass local validation.

Even if other implementations also currently ignore extras, tightening this would make the parser more strict and more explicit about the expected MIP-00 tag shape.

Desired outcome

For tags that are defined as single-valued, require the tag slice to contain exactly:

  • the tag name
  • one value

and reject:

  • missing values
  • extra trailing values

At minimum, apply this to:

  • mls_protocol_version
  • mls_ciphersuite

Suggested follow-up

  • Introduce a helper for exact single-value tag extraction/validation
  • Update the relevant validators to use it
  • Add regression tests covering:
    • missing value
    • valid single value
    • extra trailing value rejected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions