Sandbox: degrade gracefully when the namespace jail is denied (unblocks ward#108) #153

Closed
opened 2026-06-18 00:50:46 +00:00 by coilysiren · 0 comments
Owner

Sandbox: degrade gracefully when the namespace jail is denied

cli/sandbox's user+mount namespace jail needs privileges some environments deny, so every sandboxed verb dies there. Two field failure modes (downstream ward#108):

  • clone denied (container without userns): fork/exec <bin>: operation not permitted
  • make-rprivate denied (restricted mount ns): sandbox: make-rprivate: permission denied

Fix

  • Auto-degrade: when a jailed child fails to start with EPERM/EACCES (sandbox.SetupDenied), shell.Runner retries the command unsandboxed and warns once. Side-effect-safe (the child never ran); a started-then-failed run is a real error and is never degraded.
  • Opt-out: CLIGUARD_NO_SANDBOX=1 makes Wrap no-op up front (covers both modes), for environments that are already the isolation boundary.

Unblocks ward container's in-container reaper (re-execs ward, denied by the container's restricted namespace). Downstream: ward#108, and the ward container entrypoint will export CLIGUARD_NO_SANDBOX.

Docs: docs/sandbox.md. Tests: NoSandbox, Wrap opt-out, SetupDenied.

## Sandbox: degrade gracefully when the namespace jail is denied `cli/sandbox`'s user+mount namespace jail needs privileges some environments deny, so every sandboxed verb dies there. Two field failure modes (downstream ward#108): - **clone denied** (container without userns): `fork/exec <bin>: operation not permitted` - **make-rprivate denied** (restricted mount ns): `sandbox: make-rprivate: permission denied` ### Fix - **Auto-degrade**: when a jailed child fails to *start* with EPERM/EACCES (`sandbox.SetupDenied`), `shell.Runner` retries the command unsandboxed and warns once. Side-effect-safe (the child never ran); a started-then-failed run is a real error and is never degraded. - **Opt-out**: `CLIGUARD_NO_SANDBOX=1` makes `Wrap` no-op up front (covers both modes), for environments that are already the isolation boundary. Unblocks `ward container`'s in-container reaper (re-execs ward, denied by the container's restricted namespace). Downstream: ward#108, and the ward container entrypoint will export `CLIGUARD_NO_SANDBOX`. Docs: docs/sandbox.md. Tests: NoSandbox, Wrap opt-out, SetupDenied.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-flight-deck/cli-guard#153
No description provided.