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.

Role: contributor C, MQTT 5, TLS 1.3 wolfSSL/wolfMQTT
01 / What I built

Main changes

02 / Design

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.

03 / Debugging

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)

04 / Verification

How it was checked

PREvidence
#618New broker and packet unit tests in tests/test_broker_connect.c.
#623New tests/test_mqtt_tls_host.c plus broker.test cases using TLS and mutual TLS against localhost.
#470CI jobs for ASan, UBSan and LeakSan, gcc 11 to 13, clang 14 to 17, and codespell.
05 / Limits

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

all work view the repository