You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Better execution permissions and sandboxing #48411
Thanks for the detailed suggestions, @xiesl97! To sum up, you're asking for three things: show the active permission mode in the conversation and let you switch it quickly; a built-in sandbox that limits filesystem, network and process access even for approved actions; and an optional, separately configured reviewer model that can auto-approve, ask or deny requests in ask mode.
On the third one: the v2 plugin API has a permission.evaluate hook that lets a plugin change a permission request's effect (allow / ask / deny) and attach a message. That could be a starting point for a reviewer-model plugin in the meantime.
The maintainers will consider these. I couldn't search for existing issues just now, so this may be linked to related requests later.
Part 2 of this request is the main reason my team cannot move off Codex: without OS-level sandboxing we cannot give an agent unattended write access with any confidence, which is exactly what Codex's workspace-write + restricted network mode buys us today.
There are now two implementation attempts on the table:
feat(core): sandbox agent shell commands with MXC #64093 (draft) builds the feature on Microsoft MXC instead: one engine for all three platforms (Seatbelt, bubblewrap, ProcessContainer), fail-closed when the backend cannot enforce the policy, and a separate shell_unsandboxed permission so approving a sandboxed command never approves escaping it. It is verified against real backends on macOS, Linux (Debian 13 + bwrap 0.12) and Windows 11, including the platform gaps that are documented in the PR.
The design question for maintainers, before either attempt is worth polishing further: is opencode open to taking @microsoft/mxc-sdk as a dependency at all? It is the only maintained engine covering all three desktop platforms, but it currently costs about 118 MB unpacked per install (per-platform packages are being requested upstream: microsoft/mxc#1781), and MXC release builds on Windows emit required Microsoft diagnostic telemetry. If that trade-off is acceptable, #64093 is ready for design review. If it is not, the hand-rolled route of #63599 is the fallback and it would help to know which direction you prefer.
One more upstream limitation worth knowing during the review: MXC's process streams do not deliver under Bun yet (microsoft/mxc#1782), so sandboxed commands return captured output rather than streaming, which is also listed in the PR.
+1 to point 2. One useful requirement is to keep provider credentials accessible to OpenCode while making them inaccessible to model-controlled tools.
In a synthetic Linux probe, we tested OpenCode 1.18.30 inside Anthropic's srt 1.0.0 with our test configuration, using a fake credential in OPENCODE_AUTH_CONTENT. The child command did not inherit that variable, but it could recover the fake credential from its parent's /proc/<pid>/environ. So clearing the child environment was insufficient in that setup.
A tool-level sandbox seems useful here: OpenCode handles authentication, while model-controlled commands run with restricted filesystem, network, and process access. The boundary also needs to protect credential stores, including files or databases, rather than relying on a clean command environment alone. Model-controlled file-reading tools need equivalent protection.
Regression checks should confirm that OpenCode can still authenticate while model-controlled tools cannot recover a fake provider credential through credential stores, ancestor process interfaces, or inherited descriptors.
Agent shell commands (and optionally user ! commands and plugin shells) run in MXC sandboxes (Seatbelt / bubblewrap / ProcessContainer), fail-closed.
Credential stores are read-denied at the filesystem level by default - ~/.ssh, ~/.aws, ~/.gnupg, ~/.kube, provider auth.json files (~/.local/share/opencode/auth.json, ~/.codex/auth.json, ~/.claude/.credentials.json), ~/.npmrc, docker and gh configs - independent of the command environment. OpenCode itself keeps full access because only the spawned command is contained.
Escapes are a separate permission (shell_unsandboxed) that names the exact command and asks the user. (Can be disabled in config)
What it does not cover yet, matching your regression list:
Model-controlled file-reading tools (read/grep/glob) run outside the shell sandbox, so they need equivalent protection in a core implementation - a fair requirement for feat(core): sandbox agent shell commands with MXC #64093.
We have not explicitly tested the /proc/<pid>/environ ancestor vector under MXC yet; your probe is a good regression case to adopt.
The plugin reads its policy only from user-owned config outside the workspace, so a repository cannot loosen it.
Activity
github-actions commentedon Sep 11, 2026
This issue might be a duplicate of existing issues. Please check:
andrewarrow commentedon Oct 8, 2026
#53943 made this draft PR here is blog article about it https://mainbrella.com/blog/opencode-one-workspace/
opencodejr commentedon Oct 28, 2026
Thanks for the detailed suggestions, @xiesl97! To sum up, you're asking for three things: show the active permission mode in the conversation and let you switch it quickly; a built-in sandbox that limits filesystem, network and process access even for approved actions; and an optional, separately configured reviewer model that can auto-approve, ask or deny requests in
askmode.On the third one: the v2 plugin API has a
permission.evaluatehook that lets a plugin change a permission request's effect (allow/ask/deny) and attach a message. That could be a starting point for a reviewer-model plugin in the meantime.The maintainers will consider these. I couldn't search for existing issues just now, so this may be linked to related requests later.
benjaminfrombe commentedon Nov 15, 2026
Part 2 of this request is the main reason my team cannot move off Codex: without OS-level sandboxing we cannot give an agent unattended write access with any confidence, which is exactly what Codex's
workspace-write+ restricted network mode buys us today.There are now two implementation attempts on the table:
shell_unsandboxedpermission so approving a sandboxed command never approves escaping it. It is verified against real backends on macOS, Linux (Debian 13 + bwrap 0.12) and Windows 11, including the platform gaps that are documented in the PR.The design question for maintainers, before either attempt is worth polishing further: is opencode open to taking
@microsoft/mxc-sdkas a dependency at all? It is the only maintained engine covering all three desktop platforms, but it currently costs about 118 MB unpacked per install (per-platform packages are being requested upstream: microsoft/mxc#1781), and MXC release builds on Windows emit required Microsoft diagnostic telemetry. If that trade-off is acceptable, #64093 is ready for design review. If it is not, the hand-rolled route of #63599 is the fallback and it would help to know which direction you prefer.One more upstream limitation worth knowing during the review: MXC's process streams do not deliver under Bun yet (microsoft/mxc#1782), so sandboxed commands return captured output rather than streaming, which is also listed in the PR.
supernecronomicon commentedon Nov 15, 2026
+1 to point 2. One useful requirement is to keep provider credentials accessible to OpenCode while making them inaccessible to model-controlled tools.
In a synthetic Linux probe, we tested OpenCode 1.18.30 inside Anthropic's srt 1.0.0 with our test configuration, using a fake credential in
OPENCODE_AUTH_CONTENT. The child command did not inherit that variable, but it could recover the fake credential from its parent's/proc/<pid>/environ. So clearing the child environment was insufficient in that setup.A tool-level sandbox seems useful here: OpenCode handles authentication, while model-controlled commands run with restricted filesystem, network, and process access. The boundary also needs to protect credential stores, including files or databases, rather than relying on a clean command environment alone. Model-controlled file-reading tools need equivalent protection.
Regression checks should confirm that OpenCode can still authenticate while model-controlled tools cannot recover a fake provider credential through credential stores, ancestor process interfaces, or inherited descriptors.
benjaminfrombe commentedon Nov 16, 2026
@supernecronomicon - that requirement is exactly what we built into a standalone plugin in the meantime, no core changes needed:
universal-opencode-sandbox(on npm, currently 0.4.1).What it covers today:
!commands and plugin shells) run in MXC sandboxes (Seatbelt / bubblewrap / ProcessContainer), fail-closed.~/.ssh,~/.aws,~/.gnupg,~/.kube, providerauth.jsonfiles (~/.local/share/opencode/auth.json,~/.codex/auth.json,~/.claude/.credentials.json),~/.npmrc, docker and gh configs - independent of the command environment. OpenCode itself keeps full access because only the spawned command is contained.shell_unsandboxed) that names the exact command and asks the user. (Can be disabled in config)What it does not cover yet, matching your regression list:
read/grep/glob) run outside the shell sandbox, so they need equivalent protection in a core implementation - a fair requirement for feat(core): sandbox agent shell commands with MXC #64093./proc/<pid>/environancestor vector under MXC yet; your probe is a good regression case to adopt.The plugin reads its policy only from user-owned config outside the workspace, so a repository cannot loosen it.