Repository navigation
shell: a process app's program stays readable inside the OctoSense home (G6 regression) - #178
Conversation
…me (G6 regression) G6 (#156) closes the OctoSense home last in the process sandbox. Desktop builds put process apps' programs in <OctoSense home>/build, so the Terminal lost read access to its own bundle: Metal's device setup then crashed at start (SIGSEGV in IOSurface/CFBundleCopyBundleURL, 5 crash reports on macOS). Reproduced with the generated profile (exit 139) and fixed by re-allowing the program read-only after the private rules (exit 0). - macOS: after the private deny and the app's own jail, re-allow read only the program paths that lie inside a private directory. - Linux (Landlock): program rules are no longer dropped inside private directories, like the app's own jail and secrets. - Test: a program inside the OctoSense home is readable after the deny, read-only, and nothing else is reopened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I reviewed this (I wrote the G6 code). The diagnosis is right and the fix is right in shape: reopen the program read-only after the private deny, and on Linux keep program rules in Guard: never reopen a program path that equals or contains a private-sensitive dir.
Suggested rule, the same on both platforms:
Tests to add:
Linux. Minor: the new test builds the path from Otherwise LGTM. The rest can merge once CI passes and the guard is in. 🤖 Generated with Claude Code |
Review on #178: `program` also carries the checkout and the cargo cache, and `starts_with` matched a path equal to a private root, so a dev setup whose checkout or target dir is the OctoSense home would have reopened the whole home read-only (peer tokens, secrets, other apps' jails). - sandbox::program_reopenable: only a path strictly inside a private directory that neither is nor contains one, and is not inside a sensitive one (apps, secrets, the kernel's home and core dir, app-peers). - macOS: a program path inside a private dir that is not reopenable is skipped, logged, and recorded in the profile. - Linux: the kept program rule is masked to read+execute (never write, even under cargo); a skipped one is logged. - Tests: every unsafe shape is refused and nothing is reopened; the Linux rules keep read+execute only (Linux-only test). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Re-reviewed at 3619f0d. 🤖 Generated with Claude Code |
Review on #178: macOS already resolves program and private paths before comparing; Linux compared raw spellings. Landlock follows links when it opens a rule's path, so a linked checkout or grant into the OctoSense home could slip past the containment check (this held for every rule in around_private, not only programs). The split step now resolves the rule paths, the program paths, the app's own jail and secrets, and the private dirs before comparing. Test: a checkout linked to the OctoSense home reopens nothing on macOS (and, on Linux, Landlock never grants the home through the link); a link to the build dir itself still resolves strictly inside and is reopened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the program fix the Terminal starts, but every settings save failed: 'could not save settings to ~/.octosense/terminal/settings.conf: Operation not permitted'. The shell hands every child MAKEPAD_HOME = the OctoSense home, which G6 closes to process apps. A sandboxed process app now gets MAKEPAD_HOME = its jail (ADR 0004 §11), so the Terminal keeps settings in ~/.octosense/apps/terminal/terminal/. Its old folder (<OctoSense home>/<app id>) is copied into the jail once, by the host, before launch; the old copy stays. Test: the legacy folder is copied once, never over a newer jail copy, and nothing is created when there is nothing to adopt. Shell tests 578/578. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On macOS main (7abf34d) the Terminal, a native module hosted as a process on the desktop, crashes at start:
Terminal exited before opening a window (signal: 11 (SIGSEGV)). There are 5 crash reports, all inMTLCreateSystemDefaultDevice → IOSurface → CFBundleCopyBundleURL(null bundle).Cause. G6 (#156) closes the OctoSense home last in the process sandbox. Desktop builds put process apps' programs in
<OctoSense home>/build, so the private deny (last match wins) takes away the Terminal's read access to its own program and bundle.Reproduced with the generated profile:
sandbox-exec -f <profile> terminalexits 139. With the program re-allowed after the private rules, it passes Metal init and exits 0 (no hub in the test).Fix:
a_program_inside_the_octosense_home_stays_readablechecks that the program is readable after the deny, is never writable, and that nothing else is reopened.Local checks:
cargo test --locked --features mobile-apps -p octosense-shell sandbox: 12 passed, including the real macOS sandbox testhome_rw_never_reaches_the_octosense_home_or_the_kernel.🤖 Generated with Claude Code