Skip to content

fix(sandbox): preserve ownership for existing read_write paths#827

Merged
johntmyers merged 1 commit intomainfrom
fix/783-prepare-filesystem-respect-existing-ownership/johntmyers
Apr 15, 2026
Merged

fix(sandbox): preserve ownership for existing read_write paths#827
johntmyers merged 1 commit intomainfrom
fix/783-prepare-filesystem-respect-existing-ownership/johntmyers

Conversation

@johntmyers
Copy link
Copy Markdown
Collaborator

@johntmyers johntmyers commented Apr 14, 2026

🏗️ build-from-issue-agent

Summary

Preserve image-defined ownership for existing sandbox read_write paths during filesystem preparation. The supervisor now only chowns 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: extracted prepare_read_write_path(), kept the symlink guard, and limited chown() to newly-created read_write paths.
  • crates/openshell-sandbox/src/lib.rs tests: 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-commit passes
  • Unit tests added/updated
  • E2E tests added/updated (if applicable)

Tests added:

  • Unit: crates/openshell-sandbox/src/lib.rs tests covering missing-path creation, existing-path preservation, symlink rejection, and skipping chown() on existing paths.
  • Integration: N/A
  • E2E: N/A

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

Documentation updated:

  • architecture/sandbox.md: clarified that only newly-created read_write paths are re-owned.
  • architecture/security-policy.md: documented that existing image paths keep their ownership and symlinks are rejected.

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.
@johntmyers johntmyers self-assigned this Apr 14, 2026
@johntmyers johntmyers requested a review from a team as a code owner April 14, 2026 05:19
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot bot commented Apr 14, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@johntmyers johntmyers merged commit e0db01e into main Apr 15, 2026
10 checks passed
@johntmyers johntmyers deleted the fix/783-prepare-filesystem-respect-existing-ownership/johntmyers branch April 15, 2026 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prepare_filesystem() should not chown existing directories in read_write

2 participants