Conversation
…eclaim errors asset attach now rejects symlinked staging files and reads size+content from one no-follow-opened handle instead of separate exists/stat/read calls. delete_disk_blob logs unlink failures (except NotFound) instead of discarding them silently, since the DB row is already gone and the orphaned file otherwise has no way to be rediscovered. Closes item #179.
|
Warning Review limit reached
Next review available in: 8 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughMCP asset attachment now rejects staged symlinks, uses hardened bounded reads, and includes Unix coverage for symlink rejection. Disk blob deletion now logs unexpected file removal errors while ignoring missing files. ChangesAsset attachment hardening
Blob cleanup reporting
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/agentflare-store/src/blobs.rs`:
- Around line 78-81: Update the comment above delete_disk_blob to state that the
row is already gone or was never inserted, covering both the blob_unref and
blob_store call paths while preserving the existing retry and logging rationale.
In `@src/mcp_server/asset.rs`:
- Around line 46-80: Update the symlink_metadata match in the asset attachment
flow to allow only regular files: keep the existing symlink-specific error,
reject every other non-regular file type—including directories, FIFOs, devices,
and sockets—with an invalid-params error, and retain the existing missing-file
handling. Use the metadata file-type check before OpenOptions::open in the
surrounding attach method.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 5de26073-9b90-46ee-b55b-d4f732eaf8fb
📒 Files selected for processing (3)
crates/agentflare-store/src/blobs.rssrc/mcp_server/asset.rssrc/mcp_server/tests/asset_tests.rs
… comment
FIFOs/devices/sockets shared symlink-metadata's fall-through Ok(_) => {}
branch, so a named pipe dropped into staging would hang the attach
thread on the blocking read once opened. Reject anything that isn't a
regular file, same as the symlink check.
Also corrects delete_disk_blob's comment: it's called from blob_store's
insert-failure cleanup too, where no row was ever inserted, not just
from blob_unref where one existed and is now gone.
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
asset attachnow rejects symlinked staging files and reads size+content from oneO_NOFOLLOW-opened handle (Unix) instead of separate exists/stat/read calls, closing a symlink/TOCTOU bypass at the staging path.delete_disk_blob(agentflare-store) now logs unlink failures (exceptNotFound) instead of silently discarding them vialet _ =— the DB row is already gone by that point, so a failed unlink previously left an orphaned file with no way to be rediscovered or retried.Closes agentflare item #179 (CodeRabbit findings on PR #253's asset.rs, re-audited — finding 2's actual code had since moved from asset.rs into agentflare-store's
doc_delete/blob_unref; the delete-ordering logic there was already correct, the swallowed-error gap was specifically indelete_disk_blob).Test plan
cargo test -p agentflare -p agentflare-store— 110 tests pass, including newasset_attach_rejects_symlink(Unix-only)cargo clippy -p agentflare -p agentflare-store --all-targets --all-features -- -D warnings -A unsafe_code -A clippy::pedantic— cleancargo fmt --check— cleanSummary by CodeRabbit