GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [FEATURE]: Better execution permissions and sandboxing · Issue #48411 · anomalyco/opencode

[FEATURE]: Better execution permissions and sandboxing #48411

New issue
Copy link
New issue
Copy link
Open
Open
[FEATURE]: Better execution permissions and sandboxing#48411
Copy link
Assignees
nexxeln

Description

@xiesl97
xiesl97
opened on Sep 11, 2026
Issue body actions

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

OpenCode's current execution controls could be improved in three areas:

1. Make permission mode easier to access

The current permission settings are relatively hidden.

It would be useful to show the active permission mode directly in the conversation UI and allow quick switching during a session.

2. Add sandboxed execution

OpenCode has permission controls such as allow, ask, and deny, but lacks a built-in sandbox comparable to a restricted execution environment.

A sandbox could limit filesystem, network, and process access even when an action is approved.

3. Add optional model-assisted approval

For ask mode, an optional reviewer model could evaluate requested actions and decide whether to:

  • auto-approve
  • ask the user
  • deny

Ideally, the reviewer model could be configured separately from the main agent, so a small and inexpensive model can handle approval checks.

These three features would make OpenCode safer and more convenient for autonomous execution.

Reacted by KurisuWataru, PrinceGarth, James58899, Mohamed Abbas Mohamed Elsayed, Aaron Friesen, David Alan Hjelle and Stirling Goetz

Activity

  1. github-actions
    assigned
    nexxeln
    on Sep 11, 2026
  2. github-actions commented on Sep 11, 2026

    @github-actions
    github-actionsBot
    on Sep 11, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of existing issues. Please check:

    • [FEATURE]: Desktop composer: visible permission-mode control next to the model picker (ask / auto-accept / model-checked) #44249: Feature request for showing the active permission mode directly in the composer UI (matches sub-feature 1)
    • [FEATURE]: /approve — toggle permission approval mode at runtime (on/off, per-session) #41909: Feature request for toggling permission approval mode at runtime per-session (matches sub-feature 1)
    • [FEATURE]: "Auto mode" LLM model classifier auto-approval for permissions #37564: Feature request for an LLM model classifier for auto-approval of permissions (matches sub-feature 3)
    • [FEATURE]: Expose per-session automatic approval through ACP #47918: Feature request to expose per-session automatic approval through ACP (related to sub-feature 3)
    • [FEATURE]: Improve shell command permission request UX #38526: Feature request to improve shell command permission request UX (related)
  3. andrewarrow commented on Oct 8, 2026

    @andrewarrow
    andrewarrow
    on Oct 8, 2026
    More actions

    #53943 made this draft PR here is blog article about it https://mainbrella.com/blog/opencode-one-workspace/

    Reacted by S.-L. Xie
  4. opencodejr commented on Oct 28, 2026

    @opencodejr
    opencodejrBot
    on Oct 28, 2026
    Contributor
    More actions

    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.

  5. neriousy
    marked Is there a way to sandbox the agent ? #2242 as a duplicate of this issue on Nov 12, 2026
  6. benjaminfrombe commented on Nov 15, 2026

    @benjaminfrombe
    benjaminfrombe
    on Nov 15, 2026
    More actions

    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): add opt-in OS-level shell sandbox #63599 hand-rolls bubblewrap and Seatbelt profiles. No Windows backend, and the macOS profile is only string-tested.
    • 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.

  7. supernecronomicon commented on Nov 15, 2026

    @supernecronomicon
    supernecronomicon
    on Nov 15, 2026
    More actions

    +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.

    Reacted by Matijs van Zuijlen
  8. benjaminfrombe commented on Nov 16, 2026

    @benjaminfrombe
    benjaminfrombe
    on Nov 16, 2026
    More actions

    @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:

    • 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.

  9. brenoluz commented on Nov 19, 2026

    @brenoluz
    brenoluz
    on Nov 19, 2026
    More actions

    Systematic verification on v2.0.24 (most prior reports in this thread were V1 — this is the "2.0" follow-up that the V1-era closures asked for):

    What we ran (a live enforcement matrix, via the HTTP API):

    • external_directory: deny → the read tool was correctly denied ✓ — but the agent pivoted to bash: cat /tmp/... and executed, the content entered the model context (the gap reproduces on 2.0)
    • The v2 array syntax genuinely works: {action: "shell", resource: "cat /tmp/*", effect: "deny"} denied pre-execution (zero bytes executed — the scanner machinery is solid ✓), and last-match-wins behaved exactly as documented ✓
    • But the pattern deny is trivially bypassable — 4/4 executed: cat /tm""p/… (quote-splitting) · cat $HOME/../../tmp/… (expansion) · head < /tmp/… (redirection) · python3 -c 'open("…")' — and an exact-command deny was broken by merely adding a flag (cat file -n executed)

    A migration gotcha we hit: V1 permission: {bash: {...}} does not map to v2 (permissions array, the shell action) — users following pre-2.0 guides silently have no shell rules. Worth a docs/migration warning.

  10. jhmaster2000 commented on Nov 21, 2026

    @jhmaster2000
    jhmaster2000
    on Nov 21, 2026
    More actions

    I want to bring up here the fact that all of these existing PR attempts only account for sandboxing the shell tool, which is completely insufficient for proper full isolation/sandboxing of an agent's capabilities, and is still not even close to as secure or feature-complete as Codex's default sandboxed setup, which is what I and many others around this push for OpenCode sandboxing are looking for, a sandboxing experience at a bare minimum in parity with Codex.

    I have created my own PR at #62292 to address this, covering the true full spectrum of tools available to the agent under the sandbox, just like an external sandboxing solution covering the entire OpenCode process would, the difference from those being the main OpenCode process is not sandboxed, which is a benefit, as it allows intentional user actions such as ! in-chat shell commands or user-approved network requests to still function on demand, and most importantly, agent-requested shell escape approvals for commands that are necessary to run outside the sandbox with reason, meanwhile a fully sandboxed OpenCode cannot provide those escapes when needed, which is why I also don't consider those a comparable or satisfactory solution.

    Unfortunately that PR got closed for being too large, ironically, so I will now be trying to get it in by smaller chunks as requested by the bot, starting with #65168 #67011 (added Linux support now too), but I highly encourage anyone who is on macOS or Linux to try out #62292 if you're looking for a proper Codex-like and OpenCode-native agent sandboxing experience (you will need to pull and build it yourself of course), and provide any feedback on anything I might have missed still (and you can use it as your daily driver until upstream resolves this demand one way or another, I have personally being doing so and it works like a charm, and I intend to keep updating that PR somewhat-regularly until it or another proper sandboxing PR is merged, so it shouldn't fall out of date too much).

  11. john-okeefe commented on Nov 21, 2026

    @john-okeefe
    john-okeefe
    on Nov 21, 2026
    More actions

    Adding a concrete use case from #65442 (closed as a duplicate of #53955): plan mode wrote and committed code while the UI showed plan mode, because the shell tool bypasses the edit-tool deny.

    Proposal: per-agent write sandboxing at the OS level with a writable-path allowlist, the way Codex CLI does workspace-write with landlock/seccomp on Linux:

    {
      "agents": {
        "plan": { "sandbox": { "writable": ["~/.opencode/plan", "$TMPDIR"] } }
      }
    }

    Plan mode: the agent can run git log, grep, tests — anything — but writes outside the allowlist fail at the syscall no matter how the command is spelled (heredocs, redirects, tee, subshells, scripts). Build mode just adds the project tree to the allowlist.

    Command-text permission matching can't do this job: you can't classify a command as read vs write from its text (git log > /etc/hosts, echo x | sudo tee file, subshells, pipes), so the enforcement has to live at the filesystem level. An interim command-text deny-list (redirects, tee, rm, sed -i, git commit) would catch honest accidents, but text matching is bypassable and the syscall-level version is the one that actually closes the gap.

  12. benjaminfrombe commented on Nov 21, 2026

    @benjaminfrombe
    benjaminfrombe
    on Nov 21, 2026
    More actions

    @/tmp/opencode-comment.md

  13. benjaminfrombe commented on Nov 21, 2026

    @benjaminfrombe
    benjaminfrombe
    on Nov 21, 2026
    More actions

    @/tmp/opencode-comment2.md

  14. hubick commented on Nov 24, 2026

    @hubick
    hubick
    on Nov 24, 2026
    More actions

    If I attempt to sandbox an agent with a limited set of permissions in ~/.config/opencode/agents/<name>.md, and point that agent at a project folder where it is able to edit files, can the agent not just simply write .opencode/agents/<name>.md into that project folder with the same <name> (or that of any subagent it has access to invoke) and give itself a wider set of permissions via that? Am I missing something? Thanks.

  15. bmw commented on Nov 24, 2026

    @bmw
    bmw
    on Nov 24, 2026
    More actions

    If I attempt to sandbox an agent with a limited set of permissions in ~/.config/opencode/agents/<name>.md, and point that agent at a project folder where it is able to edit files, can the agent not just simply write .opencode/agents/<name>.md into that project folder with the same <name> (or that of any subagent it has access to invoke) and give itself a wider set of permissions via that? Am I missing something? Thanks.

    fwiw, i believe codex solves this by defaulting to .codex/ in the root of a project folder being read only. see https://github.com/openai/codex/blob/f22cc03b043e61a8bfd1f16880adcb19edc459c9/codex-rs/protocol/src/permissions.rs#L2395-L2438

  16. hubick commented on Nov 24, 2026

    @hubick
    hubick
    on Nov 24, 2026
    More actions

    OpenCode having a precedence model that allows projects to override the user settings seems like a bad security decision to me.

    Personally, I don't think projects should be able to modify an agent defined elsewhere at all - but at the very least not widen permissions. I wish I could disable that.

    Barring that, attempting to stop an agent from writing such instructions is interesting, but OpenCode lets you provide opencode.json throughout your entire project hierarchy, not just at the root, and both inside and outside of the .opencode/ folder.

    "permissions": [
      {"action": "edit", "resource": "opencode.json*", "effect": "deny"},
      {"action": "edit", "resource": "*/opencode.json*", "effect": "deny"},
      {"action": "edit", "resource": ".opencode/*", "effect": "deny"},
      {"action": "edit", "resource": "*/.opencode/*", "effect": "deny"}
    ]
    

    Does adding that to an agent fix this?

  17. tmccombs commented on Nov 25, 2026

    @tmccombs
    tmccombs
    on Nov 25, 2026
    More actions

    OpenCode having a precedence model that allows projects to override the user settings seems like a bad security decision to me

    Allowing it widen permissions is a problem. But I don't think there would be an issue with it narrowing permissions. That is, a project could deny access that is allowed by the global config, but it can't allow things that are denied globally.

  18. GenTang commented on Nov 25, 2026

    @GenTang
    GenTang
    on Nov 25, 2026
    More actions

    Hi, I'm on the FinShield team at Finogeeks. We see an opportunity to make OpenCode more compelling for Windows users who want to let agents work on their everyday machines with an OS-enforced execution boundary.

    OpenCode's security documentation currently states that agent execution is not sandboxed. FinShield adds an optional Windows AppContainer sandbox around the OpenCode Desktop V2 execution backend, complementing its existing permissions while keeping the Desktop workflow. We believe this could address a practical adoption concern and strengthen OpenCode's appeal to developers and teams on Windows.

    Our Agent Safety Arena publishes Windows evaluations of Codex CLI, Claude Code CLI, DeepSeek Harness and WorkBuddy across four areas: privacy, desktop interaction, system integrity and data protection. It compares agents' built-in sandboxes with FinShield, with published test conditions, recordings and reviewed results.

    Would maintainers be interested in a focused OpenCode evaluation covering normal development workflows, isolation coverage and denied operations? We'd like to agree on a supported integration path and a small compatibility test plan. The current plugin targets Windows x64, uses host networking, and has a product-licensed native engine.

    Integration guide. Who would be the right maintainer to discuss this with?

    Reacted by tanggen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @nexxeln
    nexxeln

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.