Skip to content

Validate MQTT 5 SUBSCRIBE identifiers - #2262

Merged
chkr1011 merged 1 commit into
dotnet:masterfrom
YAJeff:fix/mqtt5-subscribe-identifier
Sep 30, 2026
Merged

chkr1011 merged 1 commit into
dotnet:masterfrom
YAJeff:fix/mqtt5-subscribe-identifier

Conversation

@YAJeff

@YAJeff YAJeff commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

The MQTT 5 SUBSCRIBE decoder accepts Subscription Identifier zero and silently overwrites duplicate identifiers. Reject both as Protocol Errors, as required by MQTT 5.0 section 3.8.2.1.2: https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html.

Validation is local to each SUBSCRIBE packet. An absent identifier, valid boundary values, repeated User Properties, identifier reuse in separate SUBSCRIBE packets, and repeated identifiers in server-to-client PUBLISH remain accepted. No public API or MQTT 3 decoder changes.

Reproduction on master 18731d9: following a successful MQTT 5 CONNECT, SUBSCRIBE bytes 82 09 00 01 02 0B 00 00 01 61 00 receive SUBACK despite identifier zero. The fixed server closes the connection. Four synthetic negative regression cases fail on unmodified master; six positive cases pass.

Validation:

  • 90 formatter tests pass on each of net8.0 and net10.0, including MQTT 3 serialization.
  • Full net10.0 Release suite: 496 passed. The same-decoder positive test was then strengthened and all 90 formatter tests rerun successfully on both frameworks.
  • git diff --check and decoder whitespace verification pass.

Release solution build also passed with three warnings in unchanged benchmark code.

@chkr1011
chkr1011 merged commit 798a0e2 into dotnet:master Sep 30, 2026
6 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