moquette-io / moquette

Java MQTT lightweight broker
http://moquette-io.github.io/moquette/
Apache License 2.0
2.27k stars 814 forks source link

Implements reserved topic matching prescriptions #793

Closed andsel closed 7 months ago

andsel commented 7 months ago

Release notes

Implements requirements on reserved topics (starts with $). Implements the matching rules and avoid to proceed with processing on client's publishes on those topics.

What does this PR do?

Updates the mathcing algorithm inside CTrie to negatively match topic names in the reserved form (start with $) against wildcards position as first token of a topic filter. Refactored the tests to reuse integration fixture also outside the MQTT5 test suite, because this change regards all protocols starting from MQTT3.1.1.

Why is it important/What is the impact to the user?

Avoid the clients to use improperly reserved topics to exchange payloads. In particular avoid wildcard matching to listen inadvertently and receive unexpected topics, the clients has to explicitly subscribe to the reserved topics.

Checklist

Author's Checklist

How to test this PR locally

Related issues

Use cases