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.
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:
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.