You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(server): workspace file writes refuse the server's own state files - #39529
projects.writeFile did not refuse the server's own state files, though projects.readFile does. When a project's root contains the T3 state directory (a project at $HOME, or T3CODE_HOME/--base-dir inside a project), a client with only filesystem:write could overwrite files under secrets/ or truncate the live statev2.sqlite. A full-access client can already do this from a terminal, so only narrowly scoped clients gain anything here (SECURITY.md boundary 9).
WorkspaceFileSystem.writeFile now runs the same isServerInternalPath check as reads on the resolved target, before it creates directories or opens the file, and fails with WorkspacePathOutsideRootError like the read path. The existing state-files test now also covers writes: an existing database, an existing secret and a new file under secrets/ are refused and left unchanged.
Reviewing files that changed from the base of the PR and between 2be480c and 784f6e2.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
WorkspaceFileSystem.writeFile now rejects resolved server-internal targets. Tests cover writes to the state database and secret files, and verify that existing files remain unchanged and new files are not created.
Changes: Server-internal write protection
Layer / File(s)
Summary
Reject and test internal-path writes apps/server/src/workspace/WorkspaceFileSystem.ts, apps/server/src/workspace/WorkspaceFileSystem.test.ts
writeFile returns WorkspacePathOutsideRootError for resolved server-internal targets. Tests cover the state database, an existing secret, and a new secret, then check that existing contents remain unchanged and the new secret is not created.
Workspace file writes now refuse the server's own state files and secrets, which closes the gap for clients holding only write permission. The change is small, rejects before any file mutation, and has tests for the protected targets. No actionable merge risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: workspace file writes now refuse the server's own state files. It uses the conventional commit form and matches the objectives and the file-level summaries. It is 70 c…
Description check
The description covers the problem, the change, the scope, and the verification. The Problem section explains the write gap for clients with only filesystem:write and why it matters. The Change sectio…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: workspace file writes now refuse the server's own state files. It uses the conventional commit form and matches the objectives and the file-level summaries. It is 70 characters, which is within a typical length limit.
Full details: Description check
Explanation
The description covers the problem, the change, the scope, and the verification. The Problem section explains the write gap for clients with only filesystem:write and why it matters. The Change section explains the isServerInternalPath check on the resolved target before directory creation or file open. The Scope section cites SECURITY.md boundary 9 as the justification but does not link a bug issue or say why no issue is needed. The Verification section reports the extended state-files test and its observed results, which meets the template's bar that 'tests pass' alone is insufficient. The template's conventional-commit title guidance is followed. The author also named the model used, as the template asks for agent-driven work. The main gap is the missing issue link or justification for scope.
Resolution
Optionally link the issue that shows this bug, or state why a small fix needs no issue, as the Scope section asks.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Create a fresh isolated T3 home, register it as a project, seed an existing secret marker, then issue authenticated WebSocket reads and writes against that marker and a nonexistent secret file. Inspect disk contents afterward. Both runs used the same driver against real Linux T3 servers.
Protected database writes were not attempted to avoid corrupting the running proof servers; the existing and nonexistent secrets-file cases reproduce the reported defect.
The web client's project display was not captured; this proof exercises the server RPC behavior directly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:XS0-9 changed lines (additions + deletions).takeover:needs-juliusTakeover done; route gate says Julius decidesvouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
projects.writeFiledid not refuse the server's own state files, thoughprojects.readFiledoes. When a project's root contains the T3 state directory (a project at$HOME, orT3CODE_HOME/--base-dirinside a project), a client with onlyfilesystem:writecould overwrite files undersecrets/or truncate the livestatev2.sqlite. A full-access client can already do this from a terminal, so only narrowly scoped clients gain anything here (SECURITY.md boundary 9).WorkspaceFileSystem.writeFilenow runs the sameisServerInternalPathcheck as reads on the resolved target, before it creates directories or opens the file, and fails withWorkspacePathOutsideRootErrorlike the read path. The existing state-files test now also covers writes: an existing database, an existing secret and a new file undersecrets/are refused and left unchanged.Claude Opus 5.5 in Claude Code