Skip to content

Reject AUTH, server-sent DISCONNECT and payload bytes in UNSUBACK below v5. Publish Will on write failure. - #583

Open
kareem-wolfssl wants to merge 4 commits into
wolfSSL:masterfrom
kareem-wolfssl:gh580_2
Open

Reject AUTH, server-sent DISCONNECT and payload bytes in UNSUBACK below v5. Publish Will on write failure.#583
kareem-wolfssl wants to merge 4 commits into
wolfSSL:masterfrom
kareem-wolfssl:gh580_2

Conversation

@kareem-wolfssl

Copy link
Copy Markdown
Contributor

Fixes #580 #581 #582

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

This PR tightens MQTT protocol-level compliance by rejecting v5-only packets (AUTH, server-sent DISCONNECT) on v3.1.1 sessions, enforcing exact UNSUBACK length rules for v3.1.1, and ensuring broker-side Will publishing occurs on direct-response write failures.

Changes:

  • Enforce v3.1.1 UNSUBACK Remaining Length == 2, while allowing v5 UNSUBACK bodies.
  • Reject AUTH (type 15) and server-sent DISCONNECT on protocol level 4 sessions (read + write paths).
  • Normalize broker direct-response write failures as fatal so connections close and Wills publish; add tests for these scenarios.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/test_mqtt_packet.c Adds UNSUBACK decoding tests for v3.1.1 exact-length and v5 longer-body acceptance.
tests/test_mqtt_client.c Adds client wait/send tests rejecting v5-only packet types on v3.1.1 sessions.
tests/test_broker_connect.c Adds broker integration tests verifying Will publication on response write failures.
src/mqtt_packet.c Implements protocol-level-sensitive UNSUBACK Remaining Length validation.
src/mqtt_client.c Rejects AUTH and server-sent DISCONNECT on v3.1.1 sessions; blocks AUTH send on non-v5 sessions.
src/mqtt_broker.c Adds write-result normalization for direct responses and treats write failures as fatal to trigger Will.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/mqtt_broker.c
Comment thread src/mqtt_packet.c
Comment thread src/mqtt_broker.c
Comment thread tests/test_broker_connect.c
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.

MQTT v3.x client accepts reserved packet type 15 as AUTH

4 participants