🛡️ Sentinel: Fix Bus Error and mitigate decompression bombs#2
🛡️ Sentinel: Fix Bus Error and mitigate decompression bombs#2
Conversation
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>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
…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>
🛡️ Sentinel: [HIGH] Fix Bus Error and mitigate decompression bombs
🚨 Severity: HIGH
💡 Vulnerability:
🎯 Impact:
🔧 Fix:
std::fs::canonicalize.Read::take.✅ Verification:
./target/debug/bz2zstd test.bz2 -o test.bz2.cargo test).PR created automatically by Jules for task 4979953066344048473 started by @kassoulet