fix(messages): reject incomplete mutable put requests - #114
Merged
Conversation
andrei-21
force-pushed
the
fix/parsing-mutable-item
branch
from
August 3, 2026 14:55
b0bacc4 to
3731d3e
Compare
Return decode errors for mutable PUTs missing required fields. Reject immutable PUTs that include mutable-only fields. BREAKING CHANGE: DecodeMessageError adds MissingMutableSequence, MissingMutableSignature, and UnexpectedMutableFieldsInImmutablePut.
SeverinAlexB
approved these changes
Aug 4, 2026
SeverinAlexB
left a comment
Contributor
There was a problem hiding this comment.
Looking good. One AI finding that I have a hard time judging:
- Medium: Incomplete mutable PUTs missing k are still decoded as immutable. The branch at src/common/messages.rs:461 (src/common/messages.rs#L461) classifies solely by k; with k: None, any supplied seq, sig, salt, or cas is silently discarded at src/common/messages.rs:484 (src/common/messages.rs#L484). A valid immutable target could therefore be stored and acknowledged instead of rejected. Validate the full field combination: immutable PUTs must omit all mutable-only fields; mutable PUTs must contain k, seq, and sig. Add coverage for k: None with each mutable-only field present.
andrei-21
force-pushed
the
fix/parsing-mutable-item
branch
from
August 4, 2026 07:41
3731d3e to
8bd0fff
Compare
Contributor
Author
It makes sense, since we are breaking API anyway, I added the fix here also. |
SeverinAlexB
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prevent malformed network packets from panicking the DHT actor