Skip to content

feat(jailer): sandbox refactor with granular path access#277

Merged
DorianZheng merged 1 commit intomainfrom
feat/jailer-sandbox-refactor
Feb 16, 2026
Merged

feat(jailer): sandbox refactor with granular path access#277
DorianZheng merged 1 commit intomainfrom
feat/jailer-sandbox-refactor

Conversation

@DorianZheng
Copy link
Copy Markdown
Member

Summary

  • Sandbox abstraction: Introduce Jail trait and Jailer<S: Sandbox> generic struct with Seatbelt (macOS) and Bwrap (Linux) implementations, replacing platform-specific mod.rs files
  • Granular path access: Add build_path_access() that computes per-file/per-dir PathAccess rules with RO/RW markers, documented with a directory tree annotation
  • Console.log moved to logs/: Eliminated a standalone sandbox file grant — now covered by the existing logs/ RW subpath rule
  • Reflink support: copy_if_newer() tries CoW clone first (APFS/btrfs/xfs), falls back to regular copy; reflink_rootfs_base() for zero-cost rootfs cloning
  • Layout-based paths: guest_connect.rs uses BoxFilesystemLayout methods with fallback construction for cross-process reattach scenarios
  • Per-box shim logging: tracing_appender daily logs written to {box_dir}/logs/
  • Seatbelt policies relocated: .sbpl files moved from src/jailer/platform/macos/ to resources/seatbelt/

Test plan

  • BOXLITE_DEPS_STUB=1 cargo clippy -p boxlite --tests -- -D warnings — clean
  • cargo fmt --check -p boxlite — clean
  • cargo fmt --check -p boxlite-cli — clean
  • Python examples end-to-end (10/12 pass, 2 pre-existing sync SDK issues)
  • Cross-process reattach (share_across_processes.py) — verified after fixing layout fallback
  • No performance regressions (all changes in cold paths)

…g move

- Introduce Jail trait and Jailer<S: Sandbox> generic with Seatbelt/Bwrap impls
- Add build_path_access() for granular per-file/per-dir sandbox rules
- Move console.log into logs/ (covered by existing RW subpath)
- Add reflink-aware copy_if_newer() and reflink_rootfs_base()
- Use layout-based paths in guest_connect.rs with reattach fallback
- Add per-box shim logging via tracing_appender
- Move seatbelt .sbpl policies to resources/seatbelt/
@DorianZheng DorianZheng force-pushed the feat/jailer-sandbox-refactor branch from 488d945 to 7285ca9 Compare February 16, 2026 17:28
@DorianZheng DorianZheng merged commit 1c5b2ba into main Feb 16, 2026
14 checks passed
@DorianZheng DorianZheng deleted the feat/jailer-sandbox-refactor branch February 16, 2026 17:30
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.

1 participant