Skip to content

🛡️ Sentinel: Enforce compressed block size limit#6

Merged
kassoulet merged 1 commit into
mainfrom
sentinel/compressed-block-limit-15669133312938591188
May 1, 2026
Merged

🛡️ Sentinel: Enforce compressed block size limit#6
kassoulet merged 1 commit into
mainfrom
sentinel/compressed-block-limit-15669133312938591188

Conversation

@kassoulet

Copy link
Copy Markdown
Owner

🛡️ Sentinel: Enforce compressed block size limit

Identified a potential resource exhaustion vulnerability where maliciously crafted bzip2 files could contain extremely large block ranges, leading to excessive memory allocation. Although the uncompressed size was already limited, the compressed range should also be bounded to ensure system stability.

Changes:

  • Defined MAX_COMPRESSED_BLOCK_SIZE as 4MB in parallel_bzip2_decoder.
  • Added Bz2Error::CompressedBlockLimitExceeded to the library's error type.
  • Updated decompress_block_into to check the compressed byte length before processing.
  • Updated bz2zstd's parallel worker loop to perform the same check before calling extract_bits.
  • Added a unit test test_compressed_block_limit to verify the enforcement.

This is a defense-in-depth measure that complements the existing uncompressed block size limit.


PR created automatically by Jules for task 15669133312938591188 started by @kassoulet

This change adds a 4MB limit on the size of compressed bzip2 blocks to protect against resource exhaustion attacks.

- Added `MAX_COMPRESSED_BLOCK_SIZE` constant (4MB).
- Introduced `CompressedBlockLimitExceeded` error variant.
- Enforced limit in library's `decompress_block_into` and bz2zstd's worker loop.
- Added regression test for the limit.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@kassoulet
kassoulet merged commit 3cbb2b3 into main May 1, 2026
6 checks passed
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.

1 participant