Skip to content

P0 linux-sandbox: wrap exec_command through an isolated Codex helper - #53

Merged
novelKR merged 10 commits into
mainfrom
cursor/p0-linux-sandbox
Sep 19, 2026
Merged

novelKR merged 10 commits into
mainfrom
cursor/p0-linux-sandbox

Conversation

@novelKR

@novelKR novelKR commented Sep 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Insert an isolated crates/linux-sandbox adapter (codespace-linux-sandbox) at spawn_pipe / spawn_pty so user argv is wrapped by the pinned Codex helper (bubblewrap, then no_new_privs + seccomp). The process supervisor (process_id, stdin, terminate, timeout, PTY, lease) is unchanged.
  • CodeSpace owns the filesystem policy: Minimal RO + workspace RW + private /tmp. Codex named workspace-write (including .git RO) is not reused. This WP hard-denies network (--unshare-net + Restricted seccomp); proxy / Enabled is the next subgraph.
  • Probe (CODESPACE_LINUX_SANDBOX_BIN or a helper next to the executable) gates both spawn and advertisement. Success advertises command_sandbox=linux-sandbox and Restricted network.enforcement=enforced. Failure (macOS, no bwrap) keeps direct argv and none. A later setup/spawn error is PROCESS_SPAWN_FAILED with no unsandboxed fallback.

Test plan

  • cargo fmt (root + crates/linux-sandbox)
  • ./scripts/check-no-model-deps.sh
  • python3 -B scripts/check_docs.py
  • CI rust job: bubblewrap install, linux-sandbox fmt/clippy/test/bin, CODESPACE_LINUX_SANDBOX_BIN then cargo test --workspace
  • Linux isolation tests: workspace RW vs outside path, private /tmp, AF_INET denied / AF_UNIX allowed, PTY isatty + stdin roundtrip, SIGTERM reaps the sandbox tree
  • Advertisement: workspace_info.execution.isolation.command_sandbox is linux-sandbox only when probe succeeds; protocol_compat tool set unchanged

Made with Cursor

novelKR and others added 4 commits September 18, 2026 23:29
Keep the process supervisor unchanged and probe-gate bubblewrap/seccomp so Restricted network is enforced without an unsandboxed fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
…lock.

Fresh resolves mixed alpha.4 core crates with stable leaf crates; require locked CI, a successful Linux helper probe, and no silent Enabled-network downgrade.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use target cfg branches instead of asserting on cfg! constants in the runner and linux-sandbox isolation tests. This preserves the Linux-required CI semantics without suppressing Clippy warnings.
Regenerate the isolated codex-runtime lock after codespace-runner gained the linux-sandbox path dependency. Keep CI --locked; no manifest or runtime behavior changes.
@novelKR
novelKR force-pushed the cursor/p0-linux-sandbox branch from 628e074 to 909d3b7 Compare September 18, 2026 17:37
@novelKR
novelKR merged commit 47fdc42 into main Sep 19, 2026
15 checks passed
@novelKR
novelKR deleted the cursor/p0-linux-sandbox branch September 19, 2026 03:29
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