AI Security

Is OpenCode Safe? What It Sends, Permissions, Published Vulnerabilities and Enterprise Use

OpenCode is safe enough for most developers when it is kept current, pointed at a model provider you trust and given tighter permission rules than its defaults. This guide covers who maintains it, what the installer does, which data leaves your machine, including the free models that may keep prompts, how permissions and the background server work, the vulnerabilities published with dates and fixed versions, MCP and plugin risks, a hardening checklist and enterprise controls.

Is OpenCode safe? For most developers, yes, if it is kept updated and configured with care. OpenCode is an MIT-licensed coding agent maintained by Anomaly, and the vulnerabilities published in 2026 were fixed. The risks are in its defaults: agents may run commands and edit files without asking, and the permission system is not a sandbox. Your code goes to whichever model provider you choose.

People asking whether OpenCode is safe usually mean one of five things. Is the download legitimate? Does it send my code somewhere? Can the agent damage my machine? Has it had security holes? And can a company approve it? The answers differ, and several changed now that OpenCode 2 has replaced OpenCode 1 as the default install.

Our evidence is OpenCode’s documentation, security policy, install script and GitHub repository, the US National Vulnerability Database, and published research from Datadog Security Labs and Pillar Security, all checked on 23 November 2026. That day’s release was v2.4.0, and OpenCode 1 was still receiving updates, most recently v1.19.6 on 17 November. If you are deciding how coding agents should be approved across a company, our governance and security handbook for AI agents covers the controls in one place.

Is OpenCode safe to use? The verdict by setup

SetupVerdictWhy
Current release, a trusted paid provider, stricter permission rulesSafe for most workInference goes to a provider you chose; risky actions ask first
Default permissions on your main laptopRiskyShell, edits and access outside the project are allowed without prompts
Signed-out free modelsNot for confidential codeSome free models’ terms allow retention and use for model improvement
A model on your own hardware via Ollama, LM Studio or vLLMThe most privatePrompts stay on your network, if other features are also kept local
Inside a container or VMThe safer patternOpenCode has no sandbox of its own
opencode pair --remote or a server on 0.0.0.0Check itExposes the agent’s server beyond your machine, protected by a password
Old versions, especially before 1.18.33Update firstFixed bugs include remote command execution paths
Opening repositories you do not trustReview firstProject config can add MCP servers and commands that run on your machine

Who makes OpenCode, and how it is licensed

OpenCode is developed by Anomaly in the anomalyco/opencode repository on GitHub, under the MIT licence, with about 229,000 stars when we checked. The repository previously lived under the sst organisation. It runs as a terminal interface, a desktop app and a web interface, all talking to one OpenCode server, and it connects to many model providers, including local ones.

Anomaly also sells services around the open-source agent: OpenCode Console for hosted models and team workspaces, OpenCode Go at $10 a month for a bundle of coding models, and an enterprise offering. The agent works without any of them.

One naming trap: a search for “OpenCode” in vulnerability databases also returns unrelated products, such as a telecoms gateway from OpenCode Systems and a project called OpenCode Studio. Their CVEs say nothing about the coding agent.

Is OpenCode safe to download and install?

The documentation offers a curl installer, Homebrew, npm, Bun, pnpm, Yarn, mise, an AUR package, standalone binaries, desktop installers and a Docker image. Windows package managers are not supported. We read the OpenCode 2 installer, run as curl -fsSL https://opencode.ai/v2/install | bash, on 23 November 2026. It:

  • asks opencode.ai for the latest version, then downloads the matching platform package from the npm registry;
  • installs the binary into ~/.opencode/bin with no sudo;
  • adds that folder to your PATH by editing shell start-up files, unless you pass --no-modify-path;
  • does not verify a separate checksum or signature, so it relies on HTTPS to opencode.ai and npm.

The npm package runs a postinstall script to choose the right native binary, which is why the Bun and pnpm commands explicitly allow it. That is normal for packages with native binaries, but it means installing OpenCode runs code before you first launch it. On a managed machine, download the script or package, read it and install from the file.

Does OpenCode send your code anywhere?

Yes, to your model provider, because that is how it works. When the agent reads a file to answer you, the contents go into the prompt. OpenCode’s security policy puts that outside its own scope: data sent to your configured provider is governed by that provider’s policies. Its enterprise guide for OpenCode 1 adds that OpenCode itself does not store your code or context data, and that processing happens locally or through direct calls to your provider.

What leaves the machineWhere it goes
Prompts, file contents and tool resultsThe model provider you selected: a hosted API, OpenCode Console or Go, or a local server
Web search queriesThe search provider you connect: Exa, Firecrawl, Parallel, Tavily, TinyFish or your Claude plan
webfetch requestsThe URLs the agent fetches
MCP tool callsEach local or remote MCP server you configure
Version and model metadataopencode.ai, for updates and model lists
Remote pairing trafficAn OpenTunnel remote address, end-to-end encrypted, only if you run opencode pair --remote

OpenCode 1 also offered shareable conversation pages; its enterprise documentation recommends disabling them so data never leaves your organisation. The OpenCode 2 documentation we read does not describe a share feature.

Local state matters too. Sessions live in a SQLite database at ~/.local/share/opencode/opencode.db, logs sit under ~/.local/share/opencode/log/, and the documentation warns that heap snapshots can contain prompts, file contents and credentials. Treat those folders as sensitive.

OpenCode’s hosted and free models: what they keep

Signed-out OpenCode can use a rotating set of free models served through OpenCode. They are convenient, and they are where the privacy terms differ most. OpenCode’s model documentation says its hosted models run in the US and EU and that its providers follow a zero-retention policy without training on your data, with exceptions. As of 23 November 2026, those exceptions included:

Model or providerDocumented terms
Big PickleDuring its free period, collected data may be used to improve the model
Tidepool Alpha Free, Iceman FreeCollected data is retained and used to improve the model
Flint 40B FreeData may be used to improve the model; retained for 30 days
NVIDIA Nemotron 3.5 free endpointsTrial use only; do not submit personal or confidential data; use is logged
OpenAI, Anthropic and xAI modelsRequests retained for 30 days under the vendor’s policy
Google modelsRetained up to 55 days for abuse monitoring

Set OPENCODE_DISABLE_FREE_MODELS=1 on the OpenCode service to hide free models, or deny the signed-out free tier by policy. For OpenCode Go, workspace privacy settings block paid endpoints that train on request data by default and allow Europe and United States regions; DeepSeek V4.1 Flash, DeepSeek V4 Pro and LongCat 2.5 need the Global region switched on.

Can OpenCode run without sending code to the cloud?

Yes. OpenCode discovers Ollama at 127.0.0.1:11434, and LM Studio and vLLM have built-in local discovery, so a model on your own hardware keeps inference on your network. Our walkthrough for wiring OpenCode to local servers gives the exact configuration.

A local model protects the prompt, not everything else. For a fully local setup, also deny websearch and webfetch unless you need them, connect only MCP servers you run yourself, hide free models, and use a policy that denies every provider except the local one. And protect the model server: an Ollama port left open to the network is a separate exposure, explained in our review of Ollama’s security.

How OpenCode permissions work, and what they do not do

OpenCode 2 uses one ordered list of rules. Each rule names an action such as shell, edit, read, webfetch, external_directory or an MCP tool, a resource pattern, and an effect of allow, ask or deny. The last matching rule wins, and if nothing matches, OpenCode asks.

The defaults are permissive. Every agent starts from a base policy that allows every action, asks before reading .env files, and allows .env.example. The plan agent denies edits outside its plan folder, and the explore agent is limited to shell, reading, searching and web fetches. Two consequences surprise people:

  • Shell and edits run without prompts in the default build agent.
  • Files outside the project are reachable without a prompt. OpenCode 1 asked before touching external directories; OpenCode 2 allows them by default, and the migration guide says to add an external_directory rule to restore the prompt.

A stricter starting point looks like this:

{
  "$schema": "https://opencode.ai/config.json",
  "permissions": [
    { "action": "shell", "resource": "*", "effect": "ask" },
    { "action": "shell", "resource": "git status *", "effect": "allow" },
    { "action": "shell", "resource": "git diff *", "effect": "allow" },
    { "action": "shell", "resource": "git push *", "effect": "deny" },
    { "action": "edit", "resource": "*", "effect": "ask" },
    { "action": "external_directory", "resource": "*", "effect": "ask" },
    { "action": "read", "resource": "*/.ssh/*", "effect": "deny" }
  ]
}

Answering Allow always saves a project-scoped allow rule, so review saved approvals now and then. Configured deny rules are never overridden by a saved approval.

Now the limit. OpenCode’s security policy states that it does not sandbox the agent and that the permission system “exists as a UX feature” to keep you aware of what the agent does, “not designed to provide security isolation”. The permissions guide adds that shell commands run with the host user’s filesystem, process and network authority, and that working out which directories a command touches is best effort. For real isolation, the policy’s own advice is a Docker container or a VM; our guide to containing agents that run code compares the options.

The background server, pairing and remote access

OpenCode uses a client and server design. In OpenCode 2 a shared background service owns sessions, plugins and permissions, and the terminal, desktop and web clients talk to it. According to the documentation, it listens only on localhost by default, on port 49374 (28894 on Windows), and the web interface is password-protected. opencode pair prints a one-time link that expires after five minutes and signs a browser in for 30 days.

That design is the product of hard lessons. In January 2026, two advisories showed that an earlier, unauthenticated server with permissive CORS let any local process, or any web page, run shell commands. Current defaults fix that, but you can still widen exposure:

  • opencode service set hostname 0.0.0.0 or opencode serve --hostname 0.0.0.0 listens on every network interface.
  • opencode pair --remote exposes the server to the internet through an OpenTunnel remote address, using end-to-end encryption and the server password. It asks for confirmation once; later runs do not ask again.
  • opencode service set cors adds browser origins that may call the server.

Keep the server on localhost unless you have a reason, set a long password with opencode service set password if you widen it, and use SSH port forwarding for remote access where you can.

Published OpenCode vulnerabilities, with dates

The issues below affect the OpenCode coding agent. Fixed versions are as stated in the advisory or the researcher’s write-up.

IDPublishedWhat it isFixed in
CVE-2026-22812 (GHSA-vxw4-wv6m-9hhh)12 Jan 2026The automatically started HTTP server had no authentication and permissive CORS, so local processes or web pages could run shell commands (CVSS 8.8, high)1.0.216
CVE-2026-22813 (GHSA-c83v-7274-4vgp)12 Jan 2026Unsanitised HTML in the web UI’s markdown renderer, plus a server URL parameter, let a malicious site run commands through the terminal API (GitHub: 9.4, critical; NVD’s own score: 6.1, medium)1.1.10
CVE-2026-8862422 Sep 2026Missing path validation in worktree removal in 1.18.26 allowed arbitrary recursive directory deletionNot stated; NVD had not analysed it
GHSA-632h-h47v-g4x4 (no CVE)24 Sep 2026A cross-site request to the upgrade endpoint of opencode serve could install an attacker’s npm package, for npm, pnpm and Bun installs only1.18.22
No CVE (Pillar Security)October 2026On Windows and WSL, a remote MCP server could return an OAuth sign-in URL that executed a PowerShell command when OpenCode opened the browser1.18.33

What the list shows:

The server was the main attack surface. Three of the five issues reached OpenCode through its local HTTP server or web UI, from a web page in your browser. Datadog’s write-up of the upgrade flaw notes that the browser’s CORS rules and Local Network Access protections did not block a cross-site form submission, which is why authentication on localhost matters.

MCP servers are untrusted input. The Pillar Security finding needed only a remote MCP server you had configured, which could have been trustworthy when you added it and compromised later. The OAuth handshake started on its own, so no further user interaction was needed.

Not every fix gets a CVE. Datadog reported that Anomaly declined to request a CVE for the upgrade flaw, and Pillar Security’s report also has none. Watch the GitHub advisories and release notes, not only CVE feeds.

OpenCode’s security policy asks for reports through GitHub’s private advisory form and says it does not accept AI-generated security reports.

MCP servers, plugins and repository config: the supply-chain risk

OpenCode’s security policy puts three relevant things out of scope: data handling by your model provider, the behaviour of external MCP servers you configure, which it calls “outside our trust boundary”, and malicious config files, because users control their own configuration. Each needs your own controls.

MCP servers. A local MCP server is a command OpenCode starts on your machine; a remote one is a service that receives your tool calls and can return instructions the model will read. Each MCP tool becomes a permission action named <server>_<tool>, so you can set it to ask. Our comparison of MCP gateways covers how organisations put a control point in front of them.

Plugins. Plugins extend the server. Since v2.4.0, a plugin specified as @latest, a version range or a Git branch is checked on start-up and every 24 hours, and a newer match is installed and reloaded automatically. Pin exact versions if you want to review updates first.

Repository configuration. OpenCode merges opencode.json files and .opencode folders from the project directory up to the filesystem root. A repository you clone can therefore add MCP servers, agents, commands and permission rules. Custom commands can contain shell blocks that the documentation says run “outside the agent’s tool permission flow”. Before running OpenCode in an unfamiliar repository, look for those files.

New capabilities. v2.4.0 added automations, which let the agent schedule prompts, scripts or shell commands on timers or MCP events; a shell automation asks for approval once, when it is created. Set "automations": false if you do not want them. The same release added a desktop browser that can import sign-ins and history from Chrome, Edge, Firefox or Safari and lets the agent drive those signed-in pages; a browser deny rule refuses agent browser calls.

OpenCode hardening checklist

  1. Update. Run a current release; on 23 November 2026 that was v2.4.0, or v1.19.6 on the OpenCode 1 line. Anything older than 1.18.33 misses fixes listed above.
  2. Install from the official sources, and read the install script on managed machines.
  3. Replace the default permissions with rules that ask for shell and edit, ask for external_directory, and deny pushes and reads of SSH keys.
  4. Run it in a container or VM for untrusted repositories or long unattended tasks; OpenCode publishes a Docker image.
  5. Choose the provider deliberately. Hide free models with OPENCODE_DISABLE_FREE_MODELS=1, and allow only approved providers by policy.
  6. Keep the server local. Leave the hostname on localhost, avoid pair --remote on work machines, and keep CORS origins narrow.
  7. Vet MCP servers and set their tools to ask; prefer local servers you run yourself.
  8. Pin plugin versions and remove plugins you do not use.
  9. Check repository config (opencode.json, .opencode/) before running in code you did not write.
  10. Decide on new features. Set "automations": false and deny browser unless you need them.
  11. Protect local state. Treat ~/.local/share/opencode/ as sensitive and keep it out of backups that leave your control.
  12. Watch egress on sensitive machines to confirm traffic goes only where you expect.

Is OpenCode safe for enterprise use?

OpenCode 2 has real administrative controls. A system configuration file at /etc/opencode/opencode.json on Linux, /Library/Application Support/opencode/opencode.json on macOS (or managed preferences through MDM) and %ProgramData%\opencode\opencode.json on Windows outranks user and project settings. Its policies can:

  • deny every model provider except an internal OpenAI-compatible gateway;
  • block the signed-out free tier, or allow only your organisation’s Console workspace;
  • allow only named MCP servers, skills and plugins;
  • hard-deny specific tool uses, such as shell:git push * or reads of .ssh folders.

Console workspaces add single sign-on through OIDC or SAML, with Microsoft Entra ID, Okta and Google Workspace among the listed providers. The enterprise guide for OpenCode 1 also describes a central configuration that sends all requests through your own AI gateway, priced per seat with no token charge when you use your own gateway.

What remains your responsibility:

  • Isolation. Policies decide what the agent may attempt; they do not contain a command once it runs.
  • Audit evidence. Sessions are stored per machine. There is no organisation-wide record of which agent read which file or ran which command, so build that from your gateway and endpoint logs.
  • Data classification. Policy can force traffic through a gateway, but someone still has to decide which repositories may go to which models.
  • Unmanaged copies. Developers installing their own agents outside the managed configuration are a form of shadow AI.

For a broader view of how OpenCode compares with other harnesses on approvals and isolation, see our three-way review of agent harnesses, and for the IDE-based alternative, our Cursor privacy and security review.

How VDF AI fits

OpenCode is not part of VDF AI, and VDF AI does not run, host, resell or integrate with it. For teams that want a coding assistant under central control, VDF AI offers VDF Code: inline completions, chat, edit-mode refactors and pull request review in VS Code, JetBrains IDEs, Neovim and Visual Studio, served from the organisation’s VPC, its own data centre or a fully air-gapped installation.

The difference is where control sits. VDF Code retrieves context only from repositories the organisation authorises and uses the models it approves, and in on-premises deployments prompts, embeddings and telemetry stay inside the network. Across the platform, role-based access control and audit logs come with every plan, and on-premises deployments include Microsoft Entra ID sign-in. VDF AI Router can register Ollama and custom on-premises model deployments alongside cloud models, apply allow and deny lists, and restrict routing to local models in air-gap mode.

Sources

OpenCode’s repository, documentation and advisories, NVD records and the researchers’ own write-ups, as retrieved on 23 November 2026.


Need an AI coding assistant whose code and prompts stay inside your network? See how VDF Code runs on models you approve, or book a demo.

Frequently asked questions

Is OpenCode safe to use?

For most developers, yes, with conditions. OpenCode is open source under the MIT licence and widely used, and the serious vulnerabilities published in 2026 were fixed in later releases. The risks come from its design: by default every agent may run shell commands, edit files and read outside the project without asking, and its own security policy says the permission system is not a sandbox. Update regularly, add ask or deny rules, and run it in a container or VM for untrusted work.

Is OpenCode safe to download and install?

Download it from opencode.ai, the anomalyco/opencode GitHub repository or the documented package managers, not from look-alike sites. The OpenCode 2 curl installer fetches a platform package from the npm registry, installs it under ~/.opencode/bin without sudo, and edits your shell start-up files unless you pass --no-modify-path. It does not check a separate checksum or signature, relying on HTTPS, so read it first on a managed machine. On Windows, use the standalone binary or desktop installer.

Does OpenCode send my code to the cloud?

It sends whatever the agent puts in a prompt, including the contents of files it reads, to the model provider you select. With a hosted provider that means the provider's servers; with Ollama, LM Studio or vLLM on your own machine, it stays local. OpenCode's enterprise documentation says the project does not store your code or context data. Some free models offered through OpenCode are an exception: their documented terms allow prompts to be retained and used to improve the model.

Is OpenCode secure?

Its security record is typical of a fast-moving open-source agent. Two advisories in January 2026 showed that an unauthenticated local server and a web UI flaw let a malicious web page run commands; both were fixed. Later issues involved the upgrade endpoint, a worktree deletion bug and a Windows-only MCP sign-in flaw. Current releases put the background server on localhost behind a password. The bigger security question is configuration: permissions default to allow, and MCP servers and plugins sit outside its trust boundary.

Is OpenCode safe for enterprise use?

It can be, with central configuration. OpenCode 2 reads a system configuration file that users and repositories cannot override, where administrators can deny every model provider except an internal gateway, block the signed-out free tier, allow only approved MCP servers and deny commands such as git push. Console workspaces add single sign-on with OIDC or SAML. What it does not provide is isolation or an organisation-wide audit trail of agent actions, so pair it with containers and your own logging.

Does OpenCode collect telemetry?

The OpenCode 2 documentation we read on 23 November 2026 does not describe usage telemetry, and its enterprise guide for OpenCode 1 states that the project does not store code or context data. The software still makes network requests: to your model provider, to opencode.ai for version checks and free models, to web search providers you connect, and to MCP servers. The absence of documented telemetry is not proof, so confirm the traffic with egress monitoring before approving it for sensitive code.

Filed under
OpenCodeAI coding agentsAI securityMCP securitydata privacyAI governance
AI Governance

Is your AI governance audit-ready?

Get a readiness review of your AI controls — policy, oversight, audit trails, and EU AI Act evidence — mapped against what production actually requires.

Keep reading