fix(desktop): let Cursor chats Read attached images - #1226
Conversation
Cursor copies inlined screenshots to ~/.cursor/projects/<slug>/assets and oversized attaches live at <project>/.ade/attachments, both outside a worktree lane. The host hook denied those Reads, so the model claimed it could not open the image. Allow read-only of those two roots; keep writes, shell, other slugs, secrets, and redirected attachments denied. Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_d1a0d2da-2275-4df8-855b-3913c231fe3a) |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (7)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe Cursor SDK now receives ChangesCursor SDK path policy
Project-root worker propagation
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to The attachment-read support is narrowly scoped and covered by tests for writes, foreign paths, secrets, shell access, and symlink redirects. No current merge-blocking risk is established. Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 6 files. (1 skipped: 1 too large.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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. Comment |
Problem
Cursor ADE chats could not Read attached screenshots. The model reported it could not open the image.
Cause
ADE inlines image bytes into the Cursor SDK send. Cursor then copies them to
~/.cursor/projects/<lane-slug>/assets/and tells the model to Read that path. Oversized attachments are named as<project>/.ade/attachments/<uuid>.<ext>. Both sit outside a worktree lane, so the host path guard denied the Read.Change and boundary
The Cursor hook allowlists those two roots for read only. Worker init now passes
projectRootso the attachments grant does not guess from the lane path (missing root fails closed). After realpath, the attachments directory basename must beattachments, so a junction onto.adeor.ade/secretscannot inherit the grant. Writes, shell, other Cursor slugs,.ade/secrets, and out-of-tree redirects stay denied. Attachments are not copied into the lane. Other providers, Cursor Cloud, CLI/TUI/iOS surfaces, and the published ADE SDK are unchanged — they already share this host hook or do not evaluate it.Verification
cursorSdkPolicy.test.ts+cursorSdkPool.test.ts: 71 passed, 1 skipped/qualitygate empty (High secrets-via-redirected-attachments fixed; layout inference removed)pathComparisonKey+realpathSync.native; posix symlink cases match existingskipIf(win32)patternAuthored with Cursor Grok 4.6 via ADE.
Note
Medium Risk
Changes security-sensitive Cursor SDK path guards and attachment read policy; mitigated by read-only grants, explicit project root, and realpath/symlink checks with new tests.
Overview
Fixes Cursor local chats failing to open attached screenshots because the SDK path guard only allowed reads inside the lane worktree, while Cursor tells the model to Read inlined images from
~/.cursor/projects/<slug>/assets/and oversized attachments from<project>/.ade/attachments/.The Cursor hook hard guard now read-only allowlists those two roots. Worker init carries a required
projectRootthroughcursorSdkProtocol, pool, worker, andagentChatServiceso.ade/attachmentsis not inferred from the lane (missing root fails closed).isAllowedProjectAttachmentReaduses realpath containment, requires the attachments directory basename to stayattachments, blocks.ade/secrets, and denies symlink/junction escapes;assetsjoins the existing Cursor support read roots. Writes, shell, and other slugs stay denied.Tests cover assets, staged attachments, and symlink cases; chat docs describe the two-path image Read wiring.
Reviewed by Cursor Bugbot for commit e6c972e. Configure here.
Summary by CodeRabbit
New Features
Bug Fixes