P0 filesystem: PathSandbox over isolated Codex LOCAL_FS - #51
Merged
Merged
Conversation
Keep workspace authorization in PathSandbox, but use no-follow LOCAL_FS and a bounded walk so intermediate directory symlinks cannot escape the workspace. Co-authored-by: Cursor <cursoragent@cursor.com>
PathSandbox stays authorization only. codespace-fs now owns SymlinkRejected mapping and rollback mkdir/chmod so restore cannot follow a raced symlink. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep PATH_ESCAPE as a wire-compat collapse for NotFound/NotDirectory/Io, and pin rollback against leaf and parent symlink swaps. Co-authored-by: Cursor <cursoragent@cursor.com>
Directory symlinks become SymlinkRejected instead of PATH_ESCAPE, while a regular file in the middle of a path stays NotDirectory. Co-authored-by: Cursor <cursoragent@cursor.com>
rustix's Linux backend returns OPNOTSUPP for chmodat(SYMLINK_NOFOLLOW) even on regular files, so rollback chmod has to open the leaf with O_NOFOLLOW and fchmod the fd instead of using pathname chmod. Co-authored-by: Cursor <cursoragent@cursor.com>
7 tasks
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.
Summary
crates/file-system(codespace-fs) wrapping CodexLOCAL_FSwithsandbox: None,follow_symlinks: false, and a bounded walk. Public types stay CodeSpace-owned (Path/ bytes / walk result /FsError).PathSandboxas the authorizer. That pre-check is not the I/O safety boundary. The shared primitive is CodexLOCAL_FSno-follow: Runner-owned read/find/rollback go throughcodespace-fs;apply_patchmutation usescrates/patch→apply_patch_with_optionson the same pin.FsError. After a failed no-follow I/O (ENOTDIR/ELOOP), the adapter inspects path components without following: an ancestor symlink isSymlinkRejected; a regular file in the middle isNotDirectory. The runner maps variants only.NotFound/NotDirectory/ genericIocurrently collapse intoPATH_ESCAPE. That is not the final filesystem taxonomy. Operator-registeredworkspace.rootis the trust anchor; descendants under it are never followed.read/findstay workspace-relative with frozenLIVE_TOOLS. NoWIRE_PROTOCOLbump.64/10_000/50_000). CI scans a narrowfs_key_allowedlist and runs the adapter via--manifest-path. Remaining P0 subgraph: linux-sandbox → network.Test plan
cargo test --manifest-path crates/file-system/Cargo.tomlcargo test -p codespace-runner --lib(including directory-symlink ancestor, find skip, rollback symlink-swap)cargo test -p codespace-server --test read_find --test protocol_compat./scripts/check-no-model-deps.shpython3 -B scripts/check_docs.pycrates/file-systemplus workspaceMade with Cursor