Repository navigation
fix(binding-mqtt): answer an unresolved subscribe filter or publish acknowledgement with 0x80 - #3223
Merged
Conversation
… subscribe filter Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoWYdVYDvbXA5Wqhtso
…r that no route matches Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoWYdVYDvbXA5Wqhtso
…er or publish acknowledgement Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoWYdVYDvbXA5Wqhtso
…cknowledgement with 0x80 Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoWYdVYDvbXA5Wqhtso
This was referenced Nov 14, 2026
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.
Description
Zilla does not distinguish "no route" from "no authorized route", so a response must not reveal which topics exist behind a route. Two places answered the two cases differently or with a code that revealed the route; the maintainer decided that both answer 0x80 (Unspecified error) on MQTT 5.
MqttBindingConfig.resolveSubscribeReasonCodereturned 0x87 (Not authorized) when a route matched the topic but its guard rejected the client, and 0x83 when no route matched. MQTT 3.1.1 already answers 0x80 throughSUBACK_FAILURE_CODE_V4.MqttServerFactory.onDecodePublishUnroutableanswers an unresolved PUBLISH at QoS 1 and 2 on MQTT 5 with 0x80 in the PUBACK or PUBREC. Before, it answered 0x87 for every unresolved PUBLISH, authorized or not. The QoS 0 and MQTT 3.1.1 path (DISCONNECT 0x83) is unchanged.What changed in the code:
MqttBindingConfig.resolveSubscribeReasonCodereturnsSUCCESSwhenresolveSubscribefinds an authorized matching route, otherwiseUNSPECIFIED_ERROR. This mirrorsresolveSubscriberight above it, which already treats an unauthorized route as no route. The now-unused imports are removed.MqttServerFactory: the fallback when the binding is not found inresolveSubscribeReasonCodeusesUNSPECIFIED_ERROR, andonDecodePublishUnroutablepassesUNSPECIFIED_ERRORtodoEncodePubackV5anddoEncodePubrecV5. The method structure is unchanged; restructuring it intoonDecodePublishis a separate issue. Every comparison of a subscription's reason code in the server is== SUCCESS, so the failure code value is carried to the SUBACK and nothing else branches on it.publish.qos1.message.rejected,publish.qos2.message.rejected,*.non.successful), and the application scripts (the application peer sees no reason code for a failed filter).These script changes follow a policy decision, not implementation convenience. The specification allows several codes in both places; 0x80 is the one its tables offer when the Server does not wish to reveal the reason (quoted below). The scripts changed are network v5
client.rptandserver.rptof:subscribe.topic.filters.unroutable.mixed,subscribe.topic.filters.unroutable.all,subscribe.unroutable,subscribe.invalid.topic.guarded.identity.param,subscribe.topic.filter.unauthorized(0x83 to 0x80)publish.qos1.unroutable,publish.qos2.unroutable(0x87 to 0x80)The network v4 scripts already expect 0x80.
session.subscribe.unroutable.resumecarries no reason code on the wire.Fixes #3207
Specification statements
Read myself in the OASIS Standard pages (
mqtt-v5.0-os.htmlandmqtt-v3.1.1-os.html, downloaded, converted to text, read with grep and sed):Not read for this change: the rest of the specification beyond the clauses and tables above. The v3.1.1 SUBACK return-code table (0x80 as the only failure code) was relied on from #3191 and the existing
SUBACK_FAILURE_CODE_V4mapping rather than re-read. The PUBREL and PUBCOMP tables were not read; they are not touched.Test evidence
Test-first: the first commit of this change (
316a181e7) holds only the script changes. Against the production code of the previous head (5b43da842), run as./mvnw clean verify -pl runtime/binding-mqtt -Dit.test=..., all seven affected tests failed with aComparisonFailureon the reason code. The 10-second timeouts alongside some of them follow the mismatch.server.v5.SubscribeIT:shouldSubscribeTopicFiltersUnroutableMixed,shouldSubscribeTopicFiltersUnroutableAll,shouldSubscribeUnroutable,shouldSubscribeInvalidTopicGuardedIdentityParam,shouldSubscribeTopicFilterUnauthorized: expected SUBACK[0x80], but was[0x83](Specified behavior did not match expected:<...[0x8[0] # reason code...> but was:<...[0x8[3]]...>).server.v5.PublishIT:shouldPublishQos1Unroutable,shouldPublishQos2Unroutable: expected PUBACK/PUBREC[0x80], but was[0x87](<...et id = 1 [0x8[0] # reason code...> but was:<...et id = 1 [0x8[7] # reason code...>).The spec peer-to-peer ITs agree with the scripts because client and server scripts changed together. The second commit (
c2f699c60) holds the production change.After the fix,
clean installwith-Dmaven.build.cache.skipCache=true, checkstyle and license checks on, upstream modules installed first (-Dskip.checks=true, tests skipped), at headc2f699c60:specs/binding-mqtt.spec: 518 ITs, 0 failures, 2 skipped (+ 78 unit and schema tests, 4 skipped)specs/binding-mqtt-kafka.spec: 279 ITs, 0 failures (+ 27 unit tests)runtime/binding-mqtt: 419 ITs, 0 failures, 6 skipped (+ 44 unit tests)runtime/binding-mqtt-kafka: 160 ITs, 0 failures (+ 10 unit tests)No script of
binding-mqtt-kafkachanged andMqttBindingConfigis not used by it; bothmqtt-kafkamodules are verified as dependents.Not run: the full reactor with
-am(thebuildmodule's notice check cannot resolve snapshot siblings in this sandbox),examples/, and the other protocol modules.Not delivered
onDecodePublishUnroutableintoonDecodePublish: a separate issue after this lands.Follow-ups
onDecodePublishUnroutableintoonDecodePublish(separate issue, as above).mqtt-kafkaroute mismatch and the other items listed in fix(binding-mqtt): answer an unroutable filter with a per-filter suback failure #3191 remain as noted there.🤖 Generated with Claude Code
https://claude.ai/code/session_01SiHVoWYdVYDvbXA5Wqhtso