Feature proposal: MQTT v5.0 Enhanced Authentication (AUTH packet) support
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- c
- Ambito
- networking
Direzione di ricerca
Read the AUTH handling placeholder in source/core_mqtt.c at the cited connect-handshake lines and inspect the MQTT_ProcessLoop packet switch. Trace the existing property builders and MQTTEventCallback_t paths described in the issue, then check the related unit tests and CBMC proofs. Done means AUTH send and receive work during connection setup and on established connections, with the two reason codes and tests covering the flow.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem?
coreMQTT 5.0 supports single-step authentication (Authentication Method + Authentication Data sent once in CONNECT, accepted or rejected by the broker), but it does not support the MQTT v5.0 Enhanced Authentication flow that uses the AUTH control packet for multi-step, challenge-response exchanges.
As a result, SASL-style mechanisms such as SCRAM-SHA-256, Kerberos/GSSAPI, and OAuth token exchange / refresh cannot be used, and re-authentication on an established connection is not possible. These are commonly required by enterprise brokers (HiveMQ, EMQX) and managed services.
Current state on main (5be5f95)
The AUTH packet is recognized by the serializer/property layer but not driven end to end:
- During the connect handshake, any non-CONNACK packet (i.e. an incoming AUTH) is rejected — with an explicit placeholder:
https://github.com/FreeRTOS/coreMQTT/blob/5be5f95d12d97dbbe3cfbd0f4a9a8a1a7a5aab19/source/core_mqtt.c#L3517-L3529 (/* TODO: Handle AUTH packets here as well. */, thenMQTTBadResponse) - In the main receive loop,
MQTT_PACKET_TYPE_AUTH(0xF0) is not a case in the packet switch, so an incoming AUTH falls through todefaultand returnsMQTTBadResponse. - There is no public API to send an AUTH packet (
MQTT_Auth) and noMQTT_REASON_CONTINUE_AUTHENTICATION(0x18) /MQTT_REASON_REAUTHENTICATE(0x19) reason codes.
Notably, the building blocks already exist: the Authentication Method (0x15) and Authentication Data (0x16) properties are defined with MQTTPropAdd_AuthMethod/MQTTPropAdd_AuthData and MQTTPropGet_*, MQTT_Connect already accepts a MQTTPropBuilder_t, and MQTTEventCallback_t already carries both an incoming-property buffer and an outgoing-property buffer.
Describe the solution you'd like
A backward-compatible addition (opt-in; no change for users who don't authenticate this way), which would be a natural minor release (5.1):
- Send path — a new
MQTT_Auth()API that serializes an AUTH packet with a reason code (0x18 Continue, 0x19 Re-authenticate) and Authentication Method/Data properties, usable both mid-handshake and on an established connection. - Receive path — handle incoming AUTH in
receiveConnack(the TODO above) and in theMQTT_ProcessLooppacket switch, delivering it to the application through the existingMQTTEventCallback_t. The callback signature already fits:pGetPropsBufferexposes the broker's Authentication Data, andpSendPropsBufferlets the application supply the next response. - Reason codes — add
MQTT_REASON_CONTINUE_AUTHENTICATIONandMQTT_REASON_REAUTHENTICATEtoMQTTSuccessFailReasonCode_t.
The mechanism-specific computation (SCRAM, Kerberos, ...) stays in application code; the library only moves AUTH packets and hands their properties to/from the callback, consistent with how coreMQTT already treats properties elsewhere.
Questions for maintainers
Before proposing an implementation I'd like to check scope and preferred shape:
- Is Enhanced Authentication in scope for a future release, or intentionally left to the application layer?
- For the receive path, do you prefer reusing
MQTTEventCallback_tas above, or a dedicated auth callback? - For the send path during the handshake, should
MQTT_Connectdrive the AUTH exchange internally until CONNACK, or should it return control to the application between AUTH round-trips?
I'm happy to work on this (with unit tests and CBMC proofs matching the existing style) if there's interest and agreement on the shape.
- Lingua principale
- C
- Stelle
- 239
- Fork
- 131
- Merge medio
- 6h 51m
- PR unite (30g)
- 6
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di FreeRTOS/coreMQTT
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 32/100
-
PUBCOMP rejected with MQTTIllegalState after reconnect replays a stored PUBRELForse già presa @LogikerKit l’ha presa 25 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 56/100
-
Handle QoS2 messages when the library loses state - store state in NVMForse già presa @guclumhg l’ha presa 144 giorni fa. Apertaenhancement help wanted
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
-
coreMQTT State Access AuditApertahelp wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
Tutte le issue di FreeRTOS/coreMQTT
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 63/100
FreeRTOS/FreeRTOS-Plus-TCP#1395 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
qoretechnologies/qore#8222 ·
I maintainer di solito rispondono entro 1 giorno
-
c easy first-contributor first-contributors good first issue help wanted up-for-grabs
Difficoltà 1/5 1-3 ore Idoneità per principianti 96/100
fork-commit-merge/fork-commit-merge#8696 ·
I maintainer di solito rispondono entro 1 giorno