Skip to content

fix: Empty avro.codec.compression_level metadata panics reader via bytes[0] - #644

Merged
martin-g merged 1 commit into
04-block-message-count-unboundedfrom
06-empty-compression-level
Aug 27, 2026
Merged

martin-g merged 1 commit into
04-block-message-count-unboundedfrom
06-empty-compression-level

Conversation

@martin-g

Copy link
Copy Markdown
Member

Header parsing returns Err, never panics, on malformed metadata: all three sites use bytes.first(); an empty value yields the existing Details::BadCodecMetadata error. An explicit error (rather than silently falling back to the codec default level) was chosen because an empty level is malformed input, and failing closed on malformed attacker headers is the safer contract; the absent-key case still falls back to defaults as before.

Reported-by: Security scans

@martin-g martin-g added this to the 0.23.0 milestone Aug 25, 2026
@martin-g
martin-g requested a review from Kriskras99 August 25, 2026 13:37
@martin-g
martin-g force-pushed the 06-empty-compression-level branch from 6f3a2d8 to 6e6ad3f Compare August 26, 2026 09:55
@martin-g
martin-g force-pushed the 06-empty-compression-level branch from 6e6ad3f to 60d589b Compare August 26, 2026 11:10
@martin-g
martin-g force-pushed the 06-empty-compression-level branch from 60d589b to 55da57b Compare August 26, 2026 11:13
…tes[0]

Header parsing returns Err, never panics, on malformed metadata: all three sites
use bytes.first(); an empty value yields the existing Details::BadCodecMetadata error.
An explicit error (rather than silently falling back to the codec default level) was
chosen because an empty level is malformed input, and failing closed on malformed
attacker headers is the safer contract; the absent-key case still falls back to defaults as before.

Reported-by: Security scans
@martin-g
martin-g force-pushed the 06-empty-compression-level branch from 55da57b to 0fa0590 Compare August 26, 2026 15:40
@martin-g
martin-g merged commit fd1802e into main Aug 27, 2026
@martin-g
martin-g deleted the 06-empty-compression-level branch August 27, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants