Lightweight coding agent that runs in your terminal
Rust
docs: clarify sandboxing situation on Linux (#103)
Christopher Cooperf9c15523e737
diff --git a/README.md b/README.mdindex 235e2e33aa..ab6cf3a784 100644--- a/README.md+++ b/README.md@@ -137,13 +137,12 @@ The hardening mechanism Codex uses depends on your OS:- Outbound network is _fully blocked_ by default – even if a child processtries to `curl` somewhere it will fail.-- **Linux** – we recommend using Docker for sandboxing, where Codex launches itself inside a **minimal+- **Linux** – there is no sandboxing by default.+ We recommend using Docker for sandboxing, where Codex launches itself inside a **minimalcontainer image** and mounts your repo _read/write_ at the same path. Acustom `iptables`/`ipset` firewall script denies all egress except theOpenAI API. This gives you deterministic, reproducible runs without needing- root on the host. You can read more in [`run_in_container.sh`](./codex-cli/scripts/run_in_container.sh)--Both approaches are _transparent_ to everyday usage – you still run `codex` from your repo root and approve/reject steps as usual.+ root on the host. You can use the [`run_in_container.sh`](./codex-cli/scripts/run_in_container.sh) script to set up the sandbox.---diff --git a/codex-cli/src/utils/agent/handle-exec-command.ts b/codex-cli/src/utils/agent/handle-exec-command.tsindex 84dbbc9ced..93e8ea52aa 100644--- a/codex-cli/src/utils/agent/handle-exec-command.ts+++ b/codex-cli/src/utils/agent/handle-exec-command.ts@@ -257,7 +257,7 @@ async function execCommand(};}-const isInContainer = async (): Promise<boolean> => {+const isInLinux = async (): Promise<boolean> => {try {await access("/proc/1/cgroup");return true;@@ -270,7 +270,7 @@ async function getSandbox(runInSandbox: boolean): Promise<SandboxType> {if (runInSandbox) {if (process.platform === "darwin") {return SandboxType.MACOS_SEATBELT;- } else if (await isInContainer()) {+ } else if (await isInLinux()) {return SandboxType.NONE;}throw new Error("Sandbox was mandated, but no sandbox is available!");