OpenCode and the Wider IDE Estate
VS Code is the editor an organisation can govern; it is not the only editor on the estate. OpenCode, JetBrains, Visual Studio, Cursor, Zed and a Neovim setup built from community plugins each expose a different administrative surface, and several expose nothing a security team can pin centrally. This page covers what OpenCode documents for configuration and approval, then the residue of control that remains for the editors no central policy reaches.
What OpenCode Is
OpenCode is an agentic coding tool: it reads a repository, proposes edits and runs commands through the same host
user that launched it. The vendor documents it as v2, and the source repository is anomalyco/opencode
under the MIT licence, so the permission model is enforced by code an assessor can read rather than by a claim on a
datasheet.
It installs without procurement, so it appears on an estate with no purchase order behind it. It holds a shell, so what it can do is bounded by the account that runs it rather than by a feature list. And it is configured by file, which means its settings can be reviewed, diffed and deployed like any other infrastructure, so an editor no vendor template covers can still be pinned by configuration management.
One caution on versions: the vendor's package registry and release feed do not agree on a number, so this page cites v2 and nothing finer. The version you configure is the one you install, so take keys from the schema that ships with that build. A key documented for one release need not exist in another.
The Managed Configuration Plane
Configuration is read from four kinds of location and merged into one effective set. Precedence runs global, then outer project, then inner project, then system, with managed preferences above all of them.
| Layer | Location | Who writes it |
|---|---|---|
| Global | ~/.config/opencode/ |
The engineer |
| Project | opencode.jsonc or .opencode/opencode.jsonc |
The repository |
| System |
/etc/opencode on Linux, %ProgramData%\opencode on Windows,
/Library/Application Support/opencode on macOS
|
Endpoint management |
| Managed preferences | macOS domain ai.opencode.managed |
MDM |
Every discovered .opencode configuration overrides every direct configuration at the same depth, so a
repository can carry a file that outranks the obvious one. Settings alone cannot stop a user from adding providers,
MCP servers, agents or plugins: the vendor says so and points at the policies layer, which makes a restrictive system
file without policies a default rather than a boundary.
Above the files sits the vendor console, managing workspaces, members, SSO, SCIM and budgets. Console policies merge above project configuration, and an organisation deny cannot be lifted locally. Managed preferences and the system file still outrank the console, which makes it the strongest lever available without endpoint management, and the easiest to evidence, because the policy lives in an administrative plane rather than on a laptop.
Configuring It Defensively
Permissions are an ordered array of rules, each with an action, a resource and an effect of allow, deny or ask. The
last matching rule wins and an unmatched operation is asked. Resources match as whole tokens with * and
? wildcards rather than as regular expressions, case-insensitively on Windows with backslashes
normalised, and an operation that touches several paths is denied if any one of them is denied.
The starting point is permissive: every agent begins with a base policy that allows everything except reads of
.env and .env.*, which ask. A deny you can read is reassuring, and the risk sits in
everything the file does not mention. A rule set written for one repository says nothing about the next, and the
absence of a rule is never a denial.
Above the rules sits a separate policies array, binary allow or deny, applied after the ordered rules and after any saved approval. It can turn an allow or an ask into a deny and never grants anything, which makes it the only layer that survives an engineer choosing allow always at two in the morning. The push, the publish and the credential-bearing directory belong there rather than in the conditional rules.
Credentials belong out of the file. The {env:NAME} and {file:path}
forms are both documented, and the file form is the recommended way to keep a key out of
opencode.jsonc. Both substitute an empty string when the variable or file is missing, so a typo presents
as an absent credential rather than as an error, which is the failure a configuration test should catch. The update
preference is global and system only, because the vendor documents that project-level values for it are ignored.
{
"$schema": "https://opencode.ai/config.json",
// Ordered. The last matching rule wins, and the base policy is
// allow-all, so every rule here narrows an open default.
"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": "webfetch", "resource": "*", "effect": "deny" },
// The default allows paths outside the project. Make it a prompt.
{ "action": "external_directory", "resource": "*", "effect": "ask" }
],
// Applied after the rules above and after any saved approval.
// This layer can only deny, so it is the part a human cannot waive.
"policies": [
{ "action": "tool.use", "resource": "shell:sudo *", "effect": "deny" },
{ "action": "tool.use", "resource": "shell:curl *", "effect": "deny" }
],
"providers": {
"local-gpu": {
"package": "@opencode/ai/providers/openai-compatible",
"settings": {
"baseURL": "http://gpu-host:8000/v1",
"apiKey": "{file:~/.secrets/local-gpu-key}"
},
"models": { "qwen3-coder": {} }
}
}
}
Order is part of the control. The deny for git push has to follow the allow for the status and diff
commands, or the earlier rule wins and the deny is dead text.
Local and Self-Hosted Models
OpenCode discovers Ollama, LM Studio and vLLM installs by probing their default local addresses and adds the models
those runtimes report. Anything else that speaks the OpenAI request format is added as a provider with the
openai-compatible package, a settings.baseURL pointing at the endpoint and an explicit model list.
A local model changes the data-boundary question and leaves the authority question untouched. Prompts, file contents and diffs stop crossing a vendor boundary, so retention, training and residency become questions about a machine the organisation already owns. What does not change is what the agent may do when it answers: the same shell, the same files, the same network authority. It is a data-protection decision, not a safety control.
The swap has an operational cost, because a hosted endpoint produces egress records and a model on the same laptop produces none. Where that evidence matters, the compensating control is endpoint logging of the process and its file access, not a network rule that will never fire. One claim should also be refused: there is no documented air-gapped deployment story. Proxy variables, a private certificate authority and self-hosted providers are each documented separately, and the sum of three documented parts is not a supported air gap.
The Approval Model
There is no documented sandbox. The vendor's own note states that shell runs with the host user's
filesystem, process and network authority, and that directory inference from command text is best effort, which
argues for a narrow shell allowlist over patterns meant to recognise every dangerous command. Separately,
external_directory defaults to allowing paths outside the project, so reads and edits beyond the working
tree happen without a prompt until a rule restores one.
The Prompt Is a Decision Point, Not a Boundary
The approval gate as a sequence
Scroll sideways to see the whole diagram
Approvals come as allow once, allow always, or reject. Allow always saves the tool's proposed pattern as a durable, project-scoped allow rule, and the tool chooses what to propose: a shell approval generally saves a command prefix rather than the exact command. Saved approvals never override a configured deny, which is what makes the policies layer meaningful: an engineer can widen the prompt surface and cannot widen the hard one.
Two documented details break the intuition that reviewing the top-level array is enough. A custom subagent uses its own permissions rather than a subset of its parent's, so a permissive subagent is reachable from a restrictive primary agent. And subagent use is itself an action the model can request, so the configuration a reviewer reads is the union of top-level rules, per-agent rules and every approval saved since the last audit. Review saved approvals as configuration, because that is what they are.
IDEs Without a Central Control
The rows below record what each vendor documents for central administration. A cell reading no documented vendor admin control found is a finding, and belongs in a risk register as one.
| Editor or assistant | Documented administrative control | What it pins | Where it stops |
|---|---|---|---|
| JetBrains AI Assistant |
AI Enterprise in JetBrains IDE Services at organisation and per-profile level; .noai at the
project root; .aiignore for paths; network blocking of the JetBrains AI endpoints
|
Whether JetBrains' own assistant runs, and which paths it may read | The organisation setting does not affect third-party AI plugins |
| Visual Studio | ADMX and ADML templates under Computer Configuration > Administrative Templates > Visual Studio > Copilot Settings; MCP allowlist enforced through GitHub Copilot enterprise policies | The Copilot surface inside the IDE, delivered by Group Policy or Intune | The vendor page names only one policy explicitly; read the rest from the shipped ADML |
| Cursor |
Team dashboard for model access, MCP allowlist, run mode, repository blocklist, .cursor
protection, audit log and AI code tracking; MDM for allowed team IDs and extensions
|
Which models and MCP servers a team may use, and which repositories are indexed | The vendor calls the allowlist "best-effort, not a security boundary" |
| Zed |
disable_ai in settings; Zed for Business controls for hosted models, edit predictions, prompt
sharing and training, and spend
|
Whether the built-in hosted assistant is available, and what it costs | The documented Business controls cover the hosted path; bring-your-own-key, gateways, local models and external agents are separate model routes, and MDM management is not documented |
| Neovim with AI plugins | No documented vendor admin control found | Nothing at the editor level; the account-level Copilot policy is the accountable control | An absent documented control is not proof that none exists |
The JetBrains caveat is the one that catches people: an organisation that enables AI Enterprise has governed JetBrains' assistant and nothing else, so a third-party assistant running in the same IDE is reached by its own account policy instead. Cursor's own description of its allowlist settles the audit question: best effort is a defensible engineering position and an indefensible audit position, and the difference should be written down before it is discovered.
Zed illustrates a different failure. Its business controls cover the vendor's hosted path and stop at every route by which an engineer can supply a model: a personal key, a gateway, a local runtime, an external agent. A control covering the default path and not the alternatives is a spend control with a security appearance.
Controls That Survive an Unmanaged Editor
When the editor cannot be pinned, the enforceable controls move outward to the four layers that do not care which program is running. Each reduces blast radius; none makes the editor governed.
The first is egress policy: model traffic is HTTPS to a finite set of endpoints, so a default-deny posture with an allowlist of approved providers blocks the assistant nobody approved. Its limit is enumeration: it works only while the list is current, and it does nothing against a local model. The second is identity: SSO and device posture decide whether an account may reach the model endpoint from an unmanaged machine at all, which is the one place a personal install on a personal laptop can be refused rather than discouraged.
The third is the repository, and it is the strongest, because every editor passes through it. Push protection, rulesets, required review and a read-only default workflow token apply to a commit whatever produced it: a rule enforced at the platform survives every client decision, and a rule enforced in a client survives until somebody installs a different client. The fourth is data loss prevention on the endpoints that hold the secrets, the only layer that sees a credential pasted into a chat window rather than pushed to a remote.
Say It as a Gap
Choosing What to Allow
The estate needs a decision per editor, taken against what that editor documents, with the fallback named in advance so the gap is deliberate rather than discovered.
| If you can pin | Fall back to | Record |
|---|---|---|
| Device policy and an editor policy template | Nothing further; verify applied policy on a sample device each cycle | The policy diagnostic output, dated |
| A vendor console with SSO and SCIM | Console policies, plus MDM where the vendor documents it | The console configuration and the organisation deny |
| A configuration file only | A system-level file from configuration management, with the policies layer holding the rules no approval can lift | The deployed file, its version, and the approvals saved on a sample machine |
| Nothing documented at the editor level | Egress allowlist, SSO and device posture, repository gates, endpoint DLP | An exception with an owner, a compensating control and an expiry |
The upper rows cost engineering time and produce evidence; the bottom row costs an exception and produces a register entry. Both are legitimate outcomes, but only one of them is a control, and an estate that treats the upper rows as covering the last has confused a policy document with an inventory.