Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

message_size_limit ignores the size of Will message and MQTT5 properties #2022

Closed
umorelli opened this issue Jan 15, 2021 · 1 comment
Closed
Milestone

Comments

@umorelli
Copy link

Hello,

while performing some tests I noticed that, if setting the message_size_limit in the Mosquitto configuration, clients can bypass it via connect Will messages (with a payload up to 65'535 characters) or, with MQTT5 packets, by specifying large/many user properties (with a limit of 65'535 characters for each property name/value). Is it a bug or the intended behaviour?
- I'm asking because I could not find any reference for Will/Properties limitations in the OASIS MQTT 3/5 specifications and, in any case, Mosquitto supports limiting any MQTT packet (as a whole) via max_packet_size.

To replicate, here is a Paho Python script that sets a 65'535 characters Will message, publish a 1 character payload message (with two user properties of 65'535 x 2 chars) and disconnect with Reason Code
4 (hence publishing the Will message). A subscriber connected with mosquitto_sub -t topic -t will/topic -V 5 -F %%Payload:%p\\n%%Properties:%P\\n will receive both messages and the user properties of the PUBLISH.

Mosquitto is configure to restrict payload size to 1 byte with the following:

listener 1883
allow_anonymous true
message_size_limit 1
@ralight
Copy link
Contributor

ralight commented Jan 19, 2021

message_size_limit is explicitly for the payload only - it predates MQTT v5.

I would definitely recommend the use of max_packet_size because this controls the whole packet size, which is the more important factor. Going further, I think that message_size_limit should be deprecated in favour of max_packet_size.

Either way, the WIll payload should not be exempt from the message_size_limit and I've now fixed that. it will be part of 2.0.6 next week. Thanks for the nice report.

@ralight ralight added this to the 2.0.6 milestone Jan 19, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants