Skip to content

🛡️ Sentinel: Fix Bus Error and mitigate decompression bombs#2

Closed
kassoulet wants to merge 3 commits intomainfrom
sentinel-security-hardening-4979953066344048473
Closed

🛡️ Sentinel: Fix Bus Error and mitigate decompression bombs#2
kassoulet wants to merge 3 commits intomainfrom
sentinel-security-hardening-4979953066344048473

Conversation

@kassoulet
Copy link
Copy Markdown
Owner

🛡️ Sentinel: [HIGH] Fix Bus Error and mitigate decompression bombs

🚨 Severity: HIGH
💡 Vulnerability:

  • Bus Error (SIGBUS) when input/output files are identical due to mmap/truncation conflict.
  • Potential Decompression Bomb (DoS) via unlimited block decompression.

🎯 Impact:

  • Crashing the tool and causing data loss (truncation of input file).
  • Resource exhaustion (memory DoS) through malicious inputs.

🔧 Fix:

  • Added path identity check using std::fs::canonicalize.
  • Enforced a 2MB limit on uncompressed block size using Read::take.

✅ Verification:

  • Reproduced and verified the Bus Error fix with ./target/debug/bz2zstd test.bz2 -o test.bz2.
  • Verified decompression limit with a temporary test case.
  • Ran all existing tests (cargo test).

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

This commit addresses two security and robustness issues:
1. Prevents a Bus Error (SIGBUS) when input and output files are the same.
   The tool uses memory mapping for input and truncates the output file
   before writing. If they are the same, truncation causes a crash.
   Fixed by checking file identity with `canonicalize`.
2. Adds a 2MB decompression limit per block.
   Standard bzip2 blocks are at most 900KB. This limit provides
   defense-in-depth against decompression bombs and malformed inputs
   that could cause resource exhaustion.

Learnings recorded in .jules/sentinel.md.

Co-authored-by: kassoulet <1905+kassoulet@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.

google-labs-jules Bot and others added 2 commits January 28, 2026 22:44
…ession bombs

This commit addresses security and robustness issues:
1. Prevents a Bus Error (SIGBUS) when input and output files are the same.
   - Uses `canonicalize` to resolve symlinks and relative paths.
   - On Unix, compares device and inode numbers to correctly identify hardlinks.
2. Adds a 2MB decompression limit per block.
   - Standard bzip2 blocks are at most 900KB.
   - This limit provides defense-in-depth against decompression bombs and
     malformed inputs that could cause resource exhaustion (Memory DoS).

Learnings recorded in .jules/sentinel.md.

Co-authored-by: kassoulet <1905+kassoulet@users.noreply.github.com>
…ession bombs

This commit addresses security and robustness issues:
1. Prevents a Bus Error (SIGBUS) when input and output files are the same.
   - Uses `canonicalize` to resolve symlinks and relative paths.
   - On Unix, compares device and inode numbers to correctly identify hardlinks.
2. Adds a 2MB decompression limit per block.
   - Standard bzip2 blocks are at most 900KB.
   - This limit provides defense-in-depth against decompression bombs and
     malformed inputs that could cause resource exhaustion (Memory DoS).

Learnings recorded in .jules/sentinel.md.

Co-authored-by: kassoulet <1905+kassoulet@users.noreply.github.com>
@kassoulet kassoulet closed this Jan 29, 2026
@kassoulet kassoulet added the duplicate This issue or pull request already exists label Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant