Reject a malformed version message instead of panicking#107
Open
plaidfinch wants to merge 1 commit into
Open
Conversation
The server parsed the client's version message with version_bytes[..4], which panics on a body shorter than 4 bytes — a remotely triggerable panic for any TLS-authenticated peer, and process death under panic = "abort". Parse with a checked conversion and reject anything but exactly 4 bytes as Error::ProtocolVersion. This is stricter than the old code in one way: a version message longer than 4 bytes was previously accepted with the trailing bytes ignored. No client has ever sent one (both protocol versions send exactly CURRENT_PROTOCOL_VERSION.to_le_bytes()), so no interoperability change.
This was referenced Jul 17, 2026
plaidfinch
marked this pull request as ready for review
July 17, 2026 20:45
Member
|
The combination of this change and #108 kinda makes me wonder if it might be valuable to have a version of |
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.
CAVEAT LECTOR: This PR was generated by Claude Fable 5.
Problem
The server parses the client's first attestation-protocol message with
version_bytes[..4], which panics if the message body is shorter than 4 bytes. Any TLS-authenticated peer can trigger this with ~8 bytes (a length prefix of 2 followed by two bytes).Fix
Parse the version with a checked conversion and reject anything but exactly 4 bytes as
Error::ProtocolVersion.One deliberate strictness change: a version message longer than 4 bytes was previously accepted with the trailing bytes ignored. No client of either protocol version has ever sent one (both send exactly
CURRENT_PROTOCOL_VERSION.to_le_bytes()), so there is no interoperability change.Testing
New regression test
short_version_message_rejected: a TLS-authenticated client sends a 2-byte body; the server must returnErr(ProtocolVersion)rather than panic.Verified on illumos:
cargo test7/7, CI-style clippy clean.Relationships
Independent of #108 and #109; the three can land in any order.