wolfMQTT
wolfMQTT is a small MQTT client library with TLS 1.3, plus a broker. I fixed packet validation, session and QoS state, enhanced authentication, and TLS host checking.
Main changes
- Made the MQTT 5 AUTH exchange during CONNECT resumable so a nonblocking retry no longer loses it.#574 #575
- Made resumed persistent sessions survive, and made the TLS client check the broker certificate against the connected host.#623 #573
- Fixed MQTT 5 property validation and QoS 2 duplicate and retained-store handling.#618
- Hardened QoS delivery, persistent sessions, reauthentication, and MQTT-SN sends.#579 #577 #552
- Added sanitizer, multi-compiler, and codespell CI workflows.#470
One design choice
I split MqttClient_Auth so the message state and pending node are arguments. CONNECT keeps that state in the CONNECT ACK object and reuses the client's packetAck node, so a retry resumes. The cost is one rejected PUBLISH response in a rare overlap, which avoids sharing a buffer.
A bug I fixed
The MQTT 5 decoder range checked only two Byte properties and the encoder checked none, so a value like 2 passed. The check was keyed to property types, not the data type. I moved it onto Byte in both encoder and decoder. (#618)
How it was checked
| PR | Evidence |
|---|---|
| #618 | New broker and packet unit tests in tests/test_broker_connect.c. |
| #623 | New tests/test_mqtt_tls_host.c plus broker.test cases using TLS and mutual TLS against localhost. |
| #470 | CI jobs for ASan, UBSan and LeakSan, gcc 11 to 13, clang 14 to 17, and codespell. |
What is not done yet
An IP literal fails closed with NOT_COMPILED_IN unless wolfSSL has WOLFSSL_IP_ALT_NAME, and a user can still skip the check with a flag.
All my merged pull requests 16 in wolfSSL/wolfMQTT
- #623Preserve resumed MQTT sessions and verify TLS broker identity
- #618Fix MQTT 5 property validation and QoS 2 state handling in broker and client
- #579Harden QoS delivery, persistent sessions, reauthentication, and MQTT SN sends
- #577Harden MQTT protocol validation and lifecycle handling
- #575Fix broker session persistence and nonblocking CONTINUE handling
- #571Propagate persistence restore failures
- #570Preserve the static persistent session delivery
- #573Preserve persistent sessions on WebSocket close
- #574Preserve nonblocking enhanced authentication state
- #572Harden CONNECT credential handling compliance
- #567Low-severity hardening and compliance fixes
- #568Serialize curl getinfo under lockCURL to fix multithread stress race
- #560low-severity hardening, encode/decode validation, credential/payload zeroization, and SN/example fixes
- #552Broker, client, and MQTT v5 packet validation and reliability fixes
- #480Add Testing Validation and Fixes for wolfMQTT
- #470Add new CI tests for wolfMQTT