Skip to main content

Buyer guide

OpenCode Permission and Sandbox Policy

Turn OpenCode's allow-by-default policy into deny-first rules, secure the server, and decide where agents run in isolation.

Reading time
2 min read
Sources
10 cited

The call

Replace the default policy with ask or deny for edits, shell, and outside paths, and keep --auto runs inside a container.

OpenCode 2 allows every action except .env reads by default and ships no sandbox, so a new session can edit files and run shell commands without a prompt. Decide which actions it may take without asking and where it should run, with isolation wherever credentials matter.

When you need this

  • Engineers run OpenCode on machines that hold production or cloud credentials.
  • Someone wants --auto mode to stop approval prompts.
  • You plan to expose the OpenCode server to other hosts or phones.
  • An agent ran a command it should not have.

Evaluation criteria

  1. Start from ask, then allow

    What does the agent do on day one without a prompt?

    Look forA catch-all "*": "ask" rule first, then specific allows for reads, grep, and known-safe commands, since the last matching rule wins. Deny git push and deploy commands outright.

  2. Close the outside paths

    Can the agent read or edit outside the repository?

    Look forAn external_directory rule set to ask or deny. In OpenCode 2 paths outside the project proceed without a prompt unless you add one.

  3. Know what pattern rules miss

    Does a deny rule on a command stop every way of running it?

    Look forRules match the commands OpenCode parses from each shell call. One public test showed a git deny rule blocking git status while the same command piped to bash went through. Treat rules as a guard against mistakes and isolation as the boundary.

  4. Contain --auto

    Where may the agent approve itself?

    Look for--auto, which approves every request that is not explicitly denied, only inside a container or virtual machine with the project mounted and no SSH keys or cloud credentials.

  5. Secure the server

    Who else can reach the agent?

    Look forOPENCODE_PASSWORD on OpenCode 2, or OPENCODE_SERVER_PASSWORD on 1.x, set before binding beyond 127.0.0.1, no mDNS discovery on shared networks, and versions at or above the fixes for CVE-2026-22812 and GHSA-632h-h47v-g4x4.

Questions to ask vendors

  1. Will OpenCode add an optional sandbox, and on which platforms?
  2. Can an administrator enforce a permission policy through central config so engineers cannot loosen it?
  3. Which shell constructs does OpenCode 2's permission matching not see?
  4. Which server endpoints stay reachable without a password when the server binds to localhost?

Red flags

  • --auto on a laptop that holds production credentials.
  • The server bound to 0.0.0.0 with no password.
  • A policy that relies on denying individual commands with no isolation behind it.
  • Agents allowed to run deploy or push commands.

Products in this piece

Sources

Official documentation
8
Public source
2
  1. OpenCode 2 docs: PermissionsOfficial documentationopencode.ai
  2. OpenCode docs: Permissions (OpenCode 1)Official documentationopencode.ai
  3. OpenCode docs: AgentsOfficial documentationopencode.ai
  4. OpenCode docs: ServerOfficial documentationopencode.ai
  5. OpenCode docs: WebOfficial documentationopencode.ai
  6. OpenCode docs: NetworkOfficial documentationopencode.ai
  7. OpenCode security advisory GHSA-vxw4-wv6m-9hhh, CVE-2026-22812 (Jan 12, 2026)Official documentationgithub.com
  8. OpenCode security advisory GHSA-632h-h47v-g4x4 (Sep 24, 2026)Official documentationgithub.com
  9. CyberShadow: Unauthenticated Remote Code Execution in OpenCode (Jan 11, 2026)Public sourcecy.md
  10. Luke Wren: Stop Using OpenCode (Jul 2026)Public sourcewren.wtf