fix(sandbox): preserve ownership for existing read_write paths#827
Merged
johntmyers merged 1 commit intomainfrom Apr 15, 2026
Merged
Conversation
Closes #783 Only chown read_write paths that the supervisor creates at startup, and leave pre-existing image paths with their original ownership. Add sandbox tests for creation, symlink rejection, and existing-path ownership preservation, and update architecture docs to match the new behavior.
drew
approved these changes
Apr 15, 2026
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
Preserve image-defined ownership for existing sandbox
read_writepaths during filesystem preparation. The supervisor now onlychowns paths it creates at startup, while keeping the existing symlink safety check and adding focused regression coverage.Related Issue
Closes #783
Changes
crates/openshell-sandbox/src/lib.rs: extractedprepare_read_write_path(), kept the symlink guard, and limitedchown()to newly-createdread_writepaths.crates/openshell-sandbox/src/lib.rstests: added Unix-focused coverage for creating missing paths, preserving existing paths, rejecting symlinks, and skipping ownership changes on pre-existing paths.architecture/sandbox.md,architecture/security-policy.md: updated the architecture notes so they match the new ownership-preservation behavior.Deviations from Plan
Updated architecture docs to keep the documented filesystem-preparation behavior aligned with the implementation.
Testing
mise run pre-commitpassesTests added:
crates/openshell-sandbox/src/lib.rstests covering missing-path creation, existing-path preservation, symlink rejection, and skippingchown()on existing paths.Checklist
Documentation updated:
architecture/sandbox.md: clarified that only newly-createdread_writepaths are re-owned.architecture/security-policy.md: documented that existing image paths keep their ownership and symlinks are rejected.