You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mqtt: answer a filter that no route authorizes the same way as a filter that no route matches #3207
A SUBSCRIBE filter that cannot be routed gets a per-filter failure code in the SUBACK. MqttBindingConfig.resolveSubscribeReasonCode returns two different codes: 0x87 (Not authorized) when a route matches the topic but its guard does not authorize the client, and 0x83 (Implementation specific error) when no route matches. The two answers let a client tell which topics have a route behind them and which do not.
Zilla does not otherwise distinguish "no route" from "no authorized route", so that a response does not reveal which topics exist behind a route.
MQTT 5.0 [MQTT-3.8.4-7] requires only that the code per filter shows either the granted maximum QoS or that the subscription failed. Table 3-8 defines 0x87, but nothing in the specification requires it for this case.
Expected
A filter that no route matches and a filter that no route authorizes for the client get the same code in the SUBACK: 0x83 on MQTT 5, 0x80 on MQTT 3.1.1 (as for no route today).
Nothing else changes: the other filters of the SUBSCRIBE are granted as usual, the failed filter is not written to the session state, and the connection stays open. UNSUBSCRIBE handling is unchanged.
Open question to settle in this issue before code
The same distinction exists on the publish side: an unauthorized PUBLISH is answered with 0x87 in the failure PUBACK or PUBREC, and an unroutable one with 0x83. Decide here whether the same policy applies to publish acknowledgements, and record the decision. Do not change the publish side until it is decided.
Test plan (test-first)
Spec scripts: the unauthorized-filter scenario (subscribe.topic.filter.unauthorized, network v5 and v4, and the application scripts) expects the no-route code instead of 0x87. This script change follows the policy decision above, not the implementation: the specification does not require 0x87. The first commit holds the changed scripts and fails against the current code. The unroutable scenarios stay as they are as regression guards.
Notes
Follow-up to the per-filter SUBACK failure change under #3177. Part of the MQTT conformance work under #512.
Activity