fix(runtime): protect upload staging from workspace writers - #683
Merged
Merged
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The workspace file installer staged input inside a directory writable by native tools, so a concurrent tool could replace the staged bytes or name before commit. Require a separate existing staging directory and keep both source and destination anchored to held descriptors. The operator protects staging with native filesystem policy; the helper rejects overlapping/symlink paths and cross-filesystem or cross-mount replacement without copying. Sync both directories after commit.
The private CLI now requires a fourth staging-directory argument. Documentation specifies a per-Environment parent visible as one writable mount to the installer, while ordinary tools can write only the workspace. Credentials/history stay outside that parent. This does not enable public Files.create or change default placement, Core, daemon, Claude, dependencies or protocol semantics.
Validation: locked executor tests, formatting, Clippy and release build passed; actual pinned Codex LinuxSeccomp process RPC passed binary/empty/overwrite/50 MiB uploads, hard-link preservation, path rejection, interrupted input and rejection of concurrent staging mutations. These are synthetic-byte mechanism checks with zero model calls, not public SDK/HTTP or real-model acceptance. Full server make check passed in517.73s on executable-identical389264cd; final b30208d adds only mount-layout documentation. Fresh independent full-diff review found no concrete in-scope issues and independently passed all7 installer and5 directory tests. It did not repeat native placement qualification or the full gate. Public admission must still verify placement and handle uncertain writes across failures. No API/query change requires OpenAPI/sqlc regeneration.