Repository navigation
fix(mqtt): echo auth method on CONNACK for enhanced auth (MQTT 5 §3.2.2.3.10) - #13907
Merged
Merged
Conversation
MQTT 5.0 (§3.2.2.3.10) requires the server to echo the CONNECT's Authentication Method property on the CONNACK when the client uses enhanced authentication. The broker's accept/refuse CONNACKs omitted it, so strict clients (e.g. HiveMQ, used for native background delivery) rejected the connection with "Auth method in CONNACK must be present"; lenient clients (mqtt.js) accepted it, which hid the bug. onConnect now attaches the CONNECT's authentication method to every CONNACK (accept and refuse) via connackProperties(); refusals still carry the reason string. AUTH (reauth) already echoed the method. Covered by an e2e that asserts the CONNACK carries the method.
Contributor
|
The refusal path also attaches the authentication method, so cover it alongside the accept case to catch a regression in either response.
HarshMN2345
approved these changes
Sep 25, 2026
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
For enhanced-authentication MQTT connections, the broker now echoes the CONNECT's Authentication Method property back on the CONNACK.
Why
MQTT 5.0 §3.2.2.3.10 requires that when a client sets an Authentication Method in CONNECT (enhanced auth), the server includes the same Authentication Method in its CONNACK. The broker's
Connack::accept()(and the refusal CONNACKs) sent no such property, so:Login/JWT/origin were all fine; the sole failure was the missing CONNACK property.
Change
Handler::onConnectattaches the CONNECT's authentication method to every CONNACK — accept and refuse — via a smallconnackProperties()helper (refusals still carry the Appwrite error as the Reason String). The AUTH/reauth path already echoed the method. The library already encodes CONNACK properties (V5::connack), so no library change was needed.Test
E2E
testConnackEchoesAuthMethod(--group mqtt): a successful enhanced-auth CONNECT asserts the CONNACK carries the method (appwrite-jwt).MqttSubscribernow parses the CONNACK Authentication Method (0x15) alongside the reason string.