Skip to content

πŸ›‘οΈ Sentinel: cap decompressed archive entry reads to prevent zip bomb DoS - #317

Open
google-labs-jules[bot] wants to merge 1 commit into
mainfrom
sentinel/bounded-zip-decompression-3330383156431349778
Open

google-labs-jules[bot] wants to merge 1 commit into
mainfrom
sentinel/bounded-zip-decompression-3330383156431349778

Conversation

@google-labs-jules

Copy link
Copy Markdown
Contributor

πŸ›‘οΈ Sentinel Security Report

  • 🚨 Severity: MEDIUM
  • πŸ’‘ Vulnerability: Unbounded decompression of info.json archive entries using read_to_string directly on zip::read::ZipFile in mod_store.rs and downloader.rs.
  • 🎯 Impact: A maliciously crafted mod archive containing a compressed zip bomb could decompress gigabytes of data into memory, causing rapid memory exhaustion and crashing the application (OOM Denial of Service).
  • πŸ”§ Fix: Introduced MAX_INFO_JSON_BYTES (2 MB) and capped stream decompression reads using .take(MAX_INFO_JSON_BYTES + 1) in read_entry_to_string. Any archive entry exceeding 2 MB is immediately and safely rejected with an AppError::Parse without consuming additional memory.
  • βœ… Verification: Added unit tests in mod_store.rs (test_malformed_info_json_variants) and downloader.rs (verify_mod_zip_sync_rejects_oversized_info_json) verifying rejection of oversized entries; ran full test suite (cargo test --manifest-path src-tauri/Cargo.toml) and frontend typecheck (pnpm build).

PR created automatically by Jules for task 3330383156431349778 started by @TheDragonSoft

Unbounded decompression of `info.json` from untrusted mod ZIP archives
via `read_to_string()` exposed the application to potential zip bomb /
decompression bomb attacks causing Out-Of-Memory (OOM) Denial of Service.

This patch introduces `read_entry_to_string` with a 2 MB cap
(`MAX_INFO_JSON_BYTES`), bounding decompression stream reads via `.take()`,
and adds unit tests to verify oversized metadata entries are safely
rejected.
@google-labs-jules

Copy link
Copy Markdown
Contributor Author

πŸ‘‹ 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.

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.

0 participants