enforce max_string_size on non-strict binary message name - #3609
Conversation
Code reviewThree process issues (AGENTS.md compliance); no logic defects verified.
Coverage note (UNVERIFIABLE): `must_enforce_string_size_limit_on_non_strict_message_name` tests that a 2000-byte name is rejected at a limit of 1000. There is no test for the passing side: a name of exactly 1000 bytes should be accepted (`>` not `>=`). The implementation is correct at this boundary — a two-state proof cannot be constructed (a correct-boundary test would pass on both PR and base code) — so this is recorded as a coverage suggestion only, not a verified defect. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Jens-G
left a comment
There was a problem hiding this comment.
See "coverage note" above. Pls comment and/or consider improving the tests.
b554870 to
314d331
Compare
|
good points, all three addressed. reworded the PR description to stick to neutral functional language, so it now says what the code does rather than framing the class of the issue. on the threat-model cross-check: i went through on the coverage note: added |
|
Thank you @Jens-G for reviewing and merging the PR. Appreciated. |
the rust binary protocol reader routes every length-prefixed value through the configured
max_string_size, except one. in the non-strictread_message_beginpath (the legacy mode kept for senders that don't write the protocol-version header) the leading four bytes are taken as the message-name length and the name buffer is allocated straight from that wire value, without the check thatread_bytesandread_stringboth apply. this change runs the name length through the samemax_string_sizecheck before allocating and returns aSizeLimiterror when it is exceeded. the compact reader is unaffected because itsread_message_begingoes throughread_string, which is already bounded.kept the change inside
read_message_beginso the rest of the path is unchanged. tests: a non-strict name over the limit is now rejected withSizeLimit, and a name of exactly the configured limit is still accepted so the boundary is>and not>=.[skip ci]anywhere in the commit message to free up build resources.