Skip to content

Conversation

@GregorLohaus
Copy link

This PR changes the defaults for bash, edit, and webfetch tools to ask instead of allow.

Why:

Safety: Prevents accidental shell commands, file edits, or network requests that could be destructive or surprising for new users.

Trust & onboarding: New users expect potentially risky actions to require confirmation. Default-allow can feel unsafe and discourage adoption.

I was personally burned by these defaults when trying out opencode for the first time and qwen 3 coder just edited files with shell commands when it could not use the edit tool because it was in Planning mode.

The gemini-cli defaults to ask which felt much saner when trying it out i don't expect an ai-cli tool to just let an agent run arbitrary shell commands on my system by default.

@David-Else
Copy link

David-Else commented Sep 3, 2025

Why

    bash: {
        "*": "ask",
      },

rather than

    "bash": "ask",

?

https://opencode.ai/docs/permissions/#bash

I don't understand why this PR is not default, I don't want the agent all over my hard drive by default!

@GregorLohaus
Copy link
Author

rebased

BackSlasher added a commit to BackSlasher/opencode that referenced this pull request Jan 16, 2026
Changes the default "*": "allow" to "*": "ask" in agent defaults
to prevent auto-execution of potentially dangerous operations like bash
commands, file edits, and web fetches without user approval.

This addresses security concerns raised in anomalyco#2148 where users were
surprised that OpenCode allowed arbitrary shell commands and file
modifications by default without prompting.

The build agent and other agents still function correctly as they
explicitly override permissions where needed.

Testing:
- `bun test test/tool/bash.test.ts`: 12 pass, 0 fail
- `bun test test/tool/ test/agent/ test/permission/`: 106 pass, 28 fail
- Agent test failures are due to unrelated import issues, not this change
- Verified bash permission tests work correctly with new default
@BackSlasher
Copy link

Did fresh in #8939

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants