-
Notifications
You must be signed in to change notification settings - Fork 162
Fix: MQTT v5 Property-Packet Protocol Validation and Decode Safety #440
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
Fix: MQTT v5 Property-Packet Protocol Validation and Decode Safety #440
Conversation
|
Can one of the admins verify this patch? |
|
Hello @kaabia Thanks for sharing this PR! Could you tell us a bit about your interest in the wolfMQTT project? We require all contributors to provide a signed agreement. You can send an email mentioning this PR to Kind regards, |
Hey @embhorn We got a signed contributor agreement from @kaabia , but I haven't see yet if its approved. See ZD 20757. He also submitted wolfSSL/wolfBoot#627 |
|
Thank you for your review.
see #441 |
|
Hi @kaabia The fix for the expired certs is in. We are waiting on one more fix for the Espressif test. I'll let you know when to rebase and push. |
|
Hi @kaabia Please rebase and push to restart the tests with the test fixes in place. |
d8805da to
2971607
Compare
embhorn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sharing these changes. I am requesting one minor change.
…safety Implements necessary protocol validation in MqttEncode_Props and MqttDecode_Props to ensure that properties are only used in their allowed packet types, addressing the 'TODO: validate packet type'. - Defines new error code: MQTT_CODE_ERROR_PROPERTY_MISMATCH. - Adds critical buffer boundary checks in MqttDecode_Props before VBI and string decoding to prevent potential buffer overruns. Signed-off-by: Badr Bacem KAABIA <[email protected]>
2971607 to
b430f2c
Compare
|
Thanks for updating the PR. Looking forward to reviewing any more updates you want to share. |
Thank you as well! I sincerely appreciate your review and continued support. I'll be sure to share any further updates as soon as they are ready. 👍 |
Fixes #443
Summary
This pull request implements the required MQTT v5 protocol validation for properties and adds several buffer safety checks in the property decoding logic.
Key Changes
Protocol Compliance (Property Validation):
MqttEncode_PropsandMqttDecode_Propsto ensure a property is only used in packet types defined by itspacket_type_maskingPropMatrix. This resolves the explicitTODOin both functions.MQTT_CODE_ERROR_PROPERTY_MISMATCHfor clear reporting of protocol violations.Buffer Safety:
MqttDecode_Propsbefore decoding the property identifier (VBI) and before decoding property string data. This prevents potential buffer overruns if a packet length field is malformed or manipulated.