Repository navigation
fix: harden blob store against path injection, partial writes, and temp file leakage (#545) - #557
Conversation
…mp file leakage Five security/data-integrity fixes: 1. blob_store.py: validate hash_hex is lowercase hex before constructing filesystem path — prevents path injection via ../ or / in malformed raw_id values. 2. blob_store.py: replace bare os.write() with _write_all() that retries partial writes in a loop — prevents silent blob corruption on large chunks. 3. blob_store.py: filter .blob.* temp files in iter_all() — prevents crash-left temp files from being yielded as valid blobs. 4. blob_store.py: wrap heartbeat() calls in suppress() so a callback failure does not abort the entire blob write. 5. lib/security.py: reject absolute paths in sanitize_path() — prevents sandbox escape via attacker-controlled absolute paths like /etc/passwd when no allowlist for safe directories is configured. Also moves `import hashlib` to module level in security.py (was function-local) and updates two test files for the new absolute-path behavior. Closes #545 Co-Authored-By: Claude <[email protected]>
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 59 minutes and 56 seconds.Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b6b8e3fb47
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
…mp file leakage (#557) ## Summary Five security and data-integrity fixes to blob store and path sanitization. ## Problem - `blob_path()` had no validation on `hash_hex`, allowing path injection via `../` - `os.write()` partial writes could silently corrupt blobs - Crash-left temp files (`*.blob.*`) were yielded as valid blobs - Heartbeat callback exceptions aborted blob writes - `sanitize_path()` passed absolute paths like `/etc/passwd` through unmodified ## Solution - Validate hash_hex against `^[0-9a-f]+$` regex - Retry partial `os.write()` in a loop - Filter temp files from `iter_all()` - Suppress heartbeat exceptions with `contextlib.suppress` - Block absolute paths in `sanitize_path()`, returning `_blocked_<hash>` Closes #545 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Five security and data-integrity fixes to blob store and path sanitization.
Problem
blob_path()had no validation onhash_hex, allowing path injection via../os.write()partial writes could silently corrupt blobs*.blob.*) were yielded as valid blobssanitize_path()passed absolute paths like/etc/passwdthrough unmodifiedSolution
^[0-9a-f]+$regexos.write()in a loopiter_all()contextlib.suppresssanitize_path(), returning_blocked_<hash>Closes #545
🤖 Generated with Claude Code