fix(server): Antigravity file writes cannot escape the workspace through a linked ancestor#26184
Antigravity's client file handler checked workspace containment by realpath-ing only the target's immediate parent. When both the file and its parent were missing, it fell back to the lexical path, so a write to ws/link/a/b/file.txt (with ws/link -> /outside) passed the check. The recursive makeDirectory and the write then followed the symlink outside the workspace, even though the approved path looked like it was inside it.
The fix walks up to the deepest existing ancestor, realpaths it, and appends the missing segments before the containment check. This is the same approach as acpCanonicalPathForContainment in provider-acp, written against Effect FileSystem because that helper uses sync node:fs. Dangling or unreadable links along the way are still rejected. The existing containment test in AntigravityAdapterV2.test.ts gains a nested write through an escaping directory link. That case fails on main and passes with this change.
Opus 5.5 via Claude Code (T3 Code).
🤖 Generated with Claude Code
Checks
Added 1 commit
- fix(server): Antigravity file writes cannot escape the workspace through a linked ancestor1c48615
Approvability
Verdict: Approved at 1c48615
Macroscope's review found this PR approvable — The resolver now checks the deepest existing ancestor so linked directories cannot redirect new file writes outside the allowed roots. Existing containment restrictions remain in place, with no change to product defaults or granted access.
You can add or adjust custom eligibility rules. Learn more.
Thread transfer impact
✅ Thread transfer remains within every enforced ceiling.
ℹ️ The exact PR base did not have a successful artifact. Baseline uses the latest successful
mainmeasurement shown below.
| Provider | Metric | Main baseline | This PR | Impact | PR ceiling | |
|---|---|---|---|---|---|---|
| Codex | Total thread wire | 5.0 KiB | 5.0 KiB | +6 B (+0.1%) | 6.8 KiB | ✅ |
| Codex | Thread snapshot wire | 3.8 KiB | 3.8 KiB | 0 B (0.0%) | 4.9 KiB | ✅ |
| Codex | Live turn WebSocket wire | 1.2 KiB | 1.3 KiB | +6 B (+0.5%) | 2.0 KiB | ✅ |
| Codex | Live turn WebSocket decoded | 21.6 KiB | 21.6 KiB | 0 B (0.0%) | 24.4 KiB | ✅ |
| Codex | Live turn messages | 2 | 2 | 0 (0.0%) | 8 | ✅ |
| Claude | Total thread wire | 5.1 KiB | 5.0 KiB | −6 B (−0.1%) | 6.8 KiB | ✅ |
| Claude | Thread snapshot wire | 3.8 KiB | 3.8 KiB | 0 B (0.0%) | 4.9 KiB | ✅ |
| Claude | Live turn WebSocket wire | 1.3 KiB | 1.3 KiB | −6 B (−0.5%) | 2.0 KiB | ✅ |
| Claude | Live turn WebSocket decoded | 21.9 KiB | 21.9 KiB | 0 B (0.0%) | 24.4 KiB | ✅ |
| Claude | Live turn messages | 2 | 2 | 0 (0.0%) | 8 | ✅ |
Baseline: dde3fdb · PR result: 1c48615 · Source CI: success
Scenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
No actionable comments were generated in the recent review.
External image Recent review info
-
External image Run configuration
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: t3/fix-antigravity-symlink-escape
- File: .coderabbit.config.ts
- Commit: 1c48615
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Team
- Run ID:
40526997-559e-4e06-9f44-7b2f03adc367
External image Commits
Reviewing files that changed from the base of the PR and between cb7e3814d71c8fcdc5b803c660c29b7d7e39be96 and 1c4861557d7117a3800d225b2339109ce91ac9a1.
External image Files selected for processing: 2
apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.tsapps/server/src/provider/acp/AntigravityClientFiles.ts
Limit details: You’ve used all 10 included reviews currently available.
Walkthrough
The client file resolver now finds the deepest existing canonical ancestor of a requested path before checking containment. The containment test adds a nested write through an escaping directory symlink and verifies that the write fails without creating the outside directory.
Changes: Client file containment
Layer / File(s) Summary Canonical ancestor containment
apps/server/src/provider/acp/AntigravityClientFiles.ts,apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.tsThe resolver reattaches missing path components to the deepest existing canonical ancestor before checking allowed roots. The test verifies that a nested write through an escaping directory symlink fails and does not create the outside directory. Priority: External image Not assessed
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
maria-rcks
Merge Risk: External image Minimal · up to 1c486
This change prevents Antigravity file writes from escaping the workspace through a symlinked ancestor when the target directories do not yet exist. No remaining merge-blocking risk was found.
Pre-merge checks: Passed 3 · Failed 1
Failed Failed checks: 1 warning
Check name Status Explanation Resolution Description check Warning The description clearly explains the problem, fix, affected test, and reported verification result. It does not include the required Scope and approval information, such as a linked issue, maintainer … Add a Scope and approval section. Include the triaged issue or maintainer approval with its discussion link, or explain why this focused and obvious bug fix qualifies for the no-prior-approval exception. Add the exact focused test command a… Passed Passed checks: 3 passed
Check name Status Explanation Title check Passed The title clearly identifies the server fix that prevents Antigravity file writes from escaping the workspace through a linked ancestor. Linked Issues check Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description clearly explains the problem, fix, affected test, and reported verification result. It does not include the required Scope and approval information, such as a linked issue, maintainer approval, or an explanation for why this focused obvious-bug fix qualifies without prior approval.
Resolution
Add a Scope and approval section. Include the triaged issue or maintainer approval with its discussion link, or explain why this focused and obvious bug fix qualifies for the no-prior-approval exception. Add the exact focused test command and observed result if available.
Finishing Touches
📝 Generate docstrings
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
- Commit to this branch
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Usage-based review receipt
- Mode: Continue automatically
- Reviewed files: 2
- Charged: $0.50
- View usage details
Note
This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.
Comment @coderabbitai help to get the list of available commands.