agents: browser tools exposed despite agent-level "deny browser" when the agent has execute
Description
A subagent that explicitly denies the browser in its markdown frontmatter still receives the full browser namespace (44 tools), and its calls are dispatched rather than denied, as soon as the agent is also granted the execute (Code Mode) tool.
execute is the only way for an agent to reach MCP tools, so any agent that needs MCP access unavoidably gains desktop-browser control (navigate, browser.evaluate, file upload/download up to 5 MiB).
Expected: an explicit agent-level browser deny blocks the browser tools for that agent.
Actual: the namespace stays available and the call is dispatched. In a CLI-only session it stops at the connection check:
[browser.disconnected] No desktop browser is connected to this session. …
With a desktop browser attached to the session, the same call would succeed.
This is not #50598. There, the V2 permissions: list is parsed but never applied, so deny rules have no effect. Here the legacy permission: frontmatter block is applied — opencode debug agents shows {"action":"browser","resource":"*","effect":"deny"} on the agent — but a session-level browser: allow is appended afterwards and wins (session permissions are evaluated after agent permissions, last-match-wins).
Plugins
None configured in opencode.json / opencode.jsonc. Two local plugin files exist under ~/.config/opencode/plugins/ (graphify.js, session-date-prefix.js); neither touches the browser.
OpenCode version
2.0.22
Steps to reproduce
-
Create a read-only subagent whose frontmatter grants the Code Mode channel, e.g.:
permission: "*": deny read: allow glob: allow grep: allow execute: allow qmd_query: allow -
opencode debug agents→ the resolved permissions include{ "action": "browser", "resource": "*", "effect": "deny" }. -
Spawn that subagent and call
browser.tabs.list. Thebrowsernamespace is listed among its tools and the call is dispatched, not refused. -
Inspect the child session's permissions in the local store: they contain
{ "action": "browser", "resource": "*", "effect": "allow" }(session-level grant). -
Try stronger agent-level denies (
browser,browser*,browser.*): the capability remains.
Screenshot and/or share link
None.
Operating System
macOS 27.2.0 (Darwin kernel 27.2.0, arm64)
Terminal
tmux (TERM_PROGRAM=tmux, TERM=xterm-256color, COLORTERM=truecolor)
Additional context
BrowserTools.registerregisters every browser tool withoptions: { namespace: "browser"…, permission: "browser", codemode: true }.BrowserConnection.makepushes an agent-level{action:"browser", resource:"*", effect:"deny"}to every agent, then, when a desktop browser attaches, appends a session-level{action:"browser", resource:"*", effect:"allow"}viasession.update(...).- Because session permissions are evaluated after agent permissions (last match wins), the session-level allow neutralises the agent-level deny. Sessions using
executewere observed carrying thisbrowser: allowgrant. - Reproducible consistently. No workaround found other than not granting
execute(which also removes MCP access). - Supersedes #53294, closed automatically (free-form format lacking the required Description field).
Quick note: this issue was opened through my automation bot account (qveys-claude-bot[bot]) rather than my personal GitHub account, so it shows up under the bot's identity instead of mine. Apologies for the mix-up, I should have filed it directly from my own account. I'm behind the report and happy to answer follow-ups here as myself.
I have the same issue on linux with 2.0.27. The agent is able to open any url in a new tab despite permission being set to deny.
The following was generated by a local Qwen 3.8 27b when I was trying to figure out if my permissions were wrongly set
Confirming on 2.0.27 (Linux x64, desktop client CLI), plus two data points that may affect how this gets fixed:
1. Config-level denies are overridden the same way. Not just agent frontmatter: a global permissions entry { "action": "browser", "resource": "*", "effect": "deny" } in opencode.json is also beaten by the session-level allow appended on attach. Real-world impact: in a desktop session with a browser attached, the model opened tabs with no permission prompt despite the configured deny.
2. The tool.use policy deny is bypassed too — suggesting missing evaluation rather than rule ordering. With:
"experimental": { "policies": [ { "action": "tool.use", "resource": "browser:*", "effect": "deny" } ] }
confirmed loaded via GET /api/config, a fresh session running Code Mode await tools.browser.tabs.list() receives no permission denial — the call reaches the browser tool's own runtime and returns its transport response ([browser.disconnected] No desktop browser is connected...). In the 2.0.27 binary, tool.use policies enforce through a permission-evaluate hook that rewrites the final effect to deny after normal rule matching — no rule ordering can override it (it's the layer that makes provider/integration use policies work). Since the call still dispatched, the execute dispatch path appears to skip per-tool permission evaluation entirely for catalog tools.
Implication: if the fix is scoped to precedence (session-allow vs agent/config deny), the policy case shows that won't be sufficient on its own — the evaluate step needs to run for execute-dispatched catalog calls. The direct tool path enforces everything correctly (browser hidden from the main tool list, evaluation denied); only the Code Mode path is wide open.
Minor, same family: denied tools are still advertised in the execute catalog (- browser (45 tools, 3 shown) with signatures) despite any deny/policy.
Adding a use case that isn't covered yet: there's no documented way to allow a subset of browser operations. The docs only describe { "action": "browser", "resource": "*", "effect": "deny" }, which removes the whole catalog. I wanted to keep browser.preview for the Review pane and deny everything else (e.g. { "action": "browser", "resource": "preview", "effect": "allow" } after the deny), but nothing documents per-operation resources, and because of this issue even the blanket deny doesn't hold on 2.3.0 Desktop.
This matters because the built-in browser skill and toolset are in direct conflict with OpenCode Browse (the browse MCP server) when using the desktop app. Both get advertised as the browser primitive, the built-in catalog (45 tools plus a skill telling the agent to load it before any browser call) outweighs Browse, and there's no working permission lever to make one win. The only alternatives are a global AGENTS.md instruction on every prompt or uninstalling one of them.
Request: per-operation resources for the browser action (at minimum preview), honored in Code Mode dispatch and in the catalog listing, and a configured deny that survives desktop attach (#63614 looks like it covers that part).
Ironically, I'm posting this through Browse driving my own signed-in Chrome session. For now I'm uninstalling Browse and keeping the native browser tools.
Confirming on 2.3.2, Windows x64, Desktop app. Three additions: the allow rule is written at attach, the catalog arrives with the panel already closed, and policies reach the skill but not the catalog.
1. Config deny is overwritten at attach. { "action": "browser", "resource": "*", "effect": "deny" } in ~/.config/opencode/opencode.jsonc stays in the file, but once the browser panel connects, an allow rule for the session is written on top and the session runs open. The file keeps saying deny while the session allows — that mismatch is what made this hard to debug.
2. The catalog appears with the panel closed. Close the panel, then send a turn: the The Code Mode tool catalog has changed notice still arrives and lists browser (45 tools, N shown) with signatures. So this is not only a "while attached" leak.
3. Policies remove the skill, not the catalog. This drops the skill however it was configured — confirmed, it leaves the available list immediately:
"policies": [{ "action": "skill.use", "resource": "browser", "effect": "deny" }]
The tool catalog and the catalog-change notice keep coming, which fits the point above that execute-dispatched catalog tools skip permission evaluation.
4. Only text-level stripping works today. A context plugin hook that removes the - browser (...) block and the <skill>...<id>browser</id>...</skill> block from the system prompt and from earlier messages is the only thing that keeps the catalog out of the model's context on 2.3.2. It is a workaround, not a fix: it edits what the model reads after the fact.
What would settle it for us: a browser.enabled flag, or a config deny that survives attach and removes the catalog and the notice. Our need is binary — no browser at all in that profile.
Confirming on 2.3.0 Desktop, macOS arm64 — with one data point that may help localize this: in the same session, the permission layer does refuse the shell tool while the browser tool is dispatched. So this is specific to the browser capability, not to the permission system as a whole.
Three read-only subagents carry an explicit deny in their frontmatter:
permission:
- action: "browser"
resource: "*"
effect: deny
- action: "skill"
resource: "browser"
effect: deny
GET /api/agent/<id> returns those rules intact on each agent. No desktop browser was attached to the session.
Then, one attempt each, in the same session:
| Call | Literal result |
|---|---|
shell: find . -maxdepth 1 -name '*.md' |
permission.rejected — Permission denied: shell |
shell: git branch -D <nonexistent-branch> |
permission.rejected — Permission denied: shell |
shell: git log -1 --output=<tmp file> |
permission.rejected — Permission denied: shell |
browser.tabs.list {} |
tool.execution — [browser.disconnected] No desktop browser is connected to this session… |
Observations:
- The browser call is dispatched, not refused: it reaches the connection check. The shell calls never reach execution.
- These agents are
mode: subagent, read-only, with nowrite/edittool available at all, and no Code Mode surface in their sessions. The browser tool is exposed to them as a direct tool (the call is recorded asbrowser_tabs_list), not reached throughexecute. - So this reproduction does not depend on the
executegrant named in the title: an explicit browser deny is bypassed on 2.3.0 without it.
That is consistent with the session-level allow written on attach described above; the contrast with shell just shows the leak is confined to the browser namespace rather than affecting permission evaluation generally.
Confirming on 2.3.2, Windows x64, Desktop app — and reporting that the workaround posted earlier (text stripping in a plugin) only hides the catalog, it does not stop the call.
What I measured here:
-
{ "action": "browser", "resource": "*", "effect": "deny" }stays in the config, while the session carries{"action":"browser","resource":"*","effect":"allow"}after attach —GET /api/session/<id>shows it. Same as reported above. -
Permission hooks never see the browser. A server plugin with
ctx.permission.hook("evaluate", ...)logs everyshelldecision in the same session, but is never invoked for thebrowseraction. So the hook layer cannot be used as a second gate either. -
Stripping the catalog out of the prompt and messages works only for what the model reads.
tools.browser.tabs.list()still returns a normal response — here with an empty tab list — with no permission prompt, on 2.3.2, panel closed. A plugin that removes thebrowser (...)block and thebrowserskill cuts ~16 KB per request and still leaves the capability reachable throughsearch(). -
tool.usepolicy denies the skill, not the call: with{"action":"skill.use","resource":"browser","effect":"deny"}the skill disappears, the catalog and the catalog-change notice keep arriving.
What does block, today: the server-side tool hook, not the permission layer.
await ctx.tool.hook("execute.before", (event) => {
if (/^browser[._]/i.test(event.tool)) throw new Error("browser disabled")
})
It fires for both shapes — browser_tabs_list on the direct path and browser.tabs.list through Code Mode — and a throw becomes a tool error in the model's turn, so the call never reaches the browser runtime.
Caveats: a throw is a workaround, not a fix. It has to be installed per machine and per plugin directory, and it says nothing about the catalog still being advertised. The proper fix is presumably to run the permission evaluation on the Code Mode dispatch path and to not append a session-level allow over a configured deny.
If useful, the catalog-stripping side also has a moving target worth knowing about: the block arrives both as - browser (45 tools, N shown) // ... and, in the system prompt, as browser (45 tools, N shown) // ... without the list marker. A matcher that requires the dash silently misses the second form.
Confirming on 2.3.0, macOS arm64 (Darwin 25.6.0), Desktop app, plus a workaround that actually blocks the call, not just the catalog.
Setup: global ~/.config/opencode/opencode.jsonc has { "action": "browser", "resource": "*", "effect": "deny" } and { "action": "skill", "resource": "browser", "effect": "deny" } in permissions, plus policies { "action": "tool.use", "resource": "browser:*", "effect": "deny" } and { "action": "skill.use", "resource": "browser", "effect": "deny" }.
Observations
GET /api/agentshows the deny on every agent, yetGET /api/session/<id>on a desktop session that had the browser panel attached returns[{"action":"browser","resource":"*","effect":"allow"},{"action":"skill","resource":"browser","effect":"allow"}]. It was present on 10 of 129 sessions; every subagent spawned from those sessions inherited it, which made subagent-based tests misleading.- A fresh top-level session created via
POST /api/session(permissions[]) correctly has nobrowsernamespace:search({namespace:"browser"})returns[]andtools.browser.tabs.listfails withUnknown tool. So the config deny works; only the session-level grant defeats it. policies→skill.use browserdeny does remove the skill, buttool.use browser:*deny has no effect on the catalog or on dispatch (calls succeeded after the policy loaded), consistent with browser operations not issuing per-call permission checks.- The grant is re-applied: after removing it, Desktop wrote it back to the active session roughly a minute later.
Workaround (server plugin): reset the session-level rules whenever they appear. Listening to session.created, session.permissions and session.execution.started/succeeded, then:
const s = await ctx.session.get({ sessionID })
const perms = s.permissions ?? []
const isBrowser = (r) => r.action === "browser" || (r.action === "skill" && r.resource === "browser")
if (perms.some((r) => isBrowser(r) && r.effect !== "deny")) {
await ctx.session.update({
sessionID,
permissions: [
...perms.filter((r) => !isBrowser(r)),
{ action: "browser", resource: "*", effect: "deny" },
{ action: "skill", resource: "browser", effect: "deny" },
],
})
}
plus a one-time sweep over ctx.session.list() at setup. Result, in the same Desktop session that had the browser attached: the catalog update announces browser as no longer available, search({namespace:"browser"}) returns [], and tools.browser.tabs.list fails with Unknown tool 'browser.tabs.list'. When Desktop re-grants, the plugin removes it again within milliseconds (no update loop observed). Note: the plugin is instantiated once per open location, so side effects beyond this idempotent update need cross-instance de-duplication.
Expected: an explicit browser deny in user config (or a tool.use policy) should not be overridden by the grant Desktop writes on attach; at minimum Desktop should not attach/grant when the effective config denies browser. The docs ("A browser deny rule with resource * removes the browser catalog") currently don't hold on Desktop.
Related: #61639 (stale grants after crash), #65737 (skill still advertised).