Skip to content

Change default permissions for bash, edit, and webfetch from allow → ask - #2148

Closed
GregorLohaus wants to merge 55 commits into
anomalyco:devfrom
GregorLohaus:dev
Closed

GregorLohaus wants to merge 55 commits into
anomalyco:devfrom
GregorLohaus:dev

Conversation

@GregorLohaus

Copy link
Copy Markdown

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

David-Else commented Sep 3, 2025 •

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown

Did fresh in #8939

@GregorLohaus

Copy link
Copy Markdown
Author

Closed since default permissions have changed alot and look okay

simonklee added a commit that referenced this pull request Nov 16, 2026
…hod)

c3a007e0d..cee1698ad is #2148 and #2149, which fix record 692: when the
terminal's replies (DECRPM 2027, XTVERSION) change the width method after
startup, the scene's text follows it, and so do Code, Input, Textarea and
TextTable, whose buffers keep their cursors, selections, marks, styled
runs and undo points on their text.

opentui.h changes (FNV-1a 64 0x99dd2d0018a6caa3, which generated.rs
names at cee1698ad): ot_edit_buffer_options's zero `reserved` word is now
`flags`, with OT_EDIT_BUFFER_FOLLOW_SESSION_WIDTH; a scene op
OT_SCENE_TEXT_SELECTION_COLORS; and ot_text_buffer_set_width_method. No
client code uses opentui-sys directly, so nothing names `reserved`, and
the opentui API the client calls is unchanged. The native library is in
~/.cache/opentui-native/cee1698ad/x86_64-linux, which
.cargo/config.toml names.
simonklee added a commit that referenced this pull request Nov 16, 2026
…nges late

OT/late-width (P-PTY) opens the home screen, then sends the DECRPM 2027
reply a terminal without grapheme clustering gives (mode 0), after
startup's wait, and types a thumb with a skin tone into the prompt that
already exists. With #2148 the prompt measures it as 4 cells and puts
its cursor there; @opentui/core 0.8.4, which TS runs, keeps the prompt's
startup width and puts the cursor 2 cells on. The screens are equal; the
cursor line differs, which OT2148-live-width-method records (O-89). On
the earlier pin the Rust prompt drew the thumb without its skin tone.
simonklee added a commit that referenced this pull request Nov 17, 2026
…hod)

c3a007e0d..cee1698ad is #2148 and #2149, which fix record 692: when the
terminal's replies (DECRPM 2027, XTVERSION) change the width method after
startup, the scene's text follows it, and so do Code, Input, Textarea and
TextTable, whose buffers keep their cursors, selections, marks, styled
runs and undo points on their text.

opentui.h changes (FNV-1a 64 0x99dd2d0018a6caa3, which generated.rs
names at cee1698ad): ot_edit_buffer_options's zero `reserved` word is now
`flags`, with OT_EDIT_BUFFER_FOLLOW_SESSION_WIDTH; a scene op
OT_SCENE_TEXT_SELECTION_COLORS; and ot_text_buffer_set_width_method. No
client code uses opentui-sys directly, so nothing names `reserved`, and
the opentui API the client calls is unchanged. The native library is in
~/.cache/opentui-native/cee1698ad/x86_64-linux, which
.cargo/config.toml names.
simonklee added a commit that referenced this pull request Nov 17, 2026
…nges late

OT/late-width (P-PTY) opens the home screen, then sends the DECRPM 2027
reply a terminal without grapheme clustering gives (mode 0), after
startup's wait, and types a thumb with a skin tone into the prompt that
already exists. With #2148 the prompt measures it as 4 cells and puts
its cursor there; @opentui/core 0.8.4, which TS runs, keeps the prompt's
startup width and puts the cursor 2 cells on. The screens are equal; the
cursor line differs, which OT2148-live-width-method records (O-89). On
the earlier pin the Rust prompt drew the thumb without its skin tone.
simonklee added a commit that referenced this pull request Nov 17, 2026
…hod)

c3a007e0d..cee1698ad is #2148 and #2149, which fix record 692: when the
terminal's replies (DECRPM 2027, XTVERSION) change the width method after
startup, the scene's text follows it, and so do Code, Input, Textarea and
TextTable, whose buffers keep their cursors, selections, marks, styled
runs and undo points on their text.

opentui.h changes (FNV-1a 64 0x99dd2d0018a6caa3, which generated.rs
names at cee1698ad): ot_edit_buffer_options's zero `reserved` word is now
`flags`, with OT_EDIT_BUFFER_FOLLOW_SESSION_WIDTH; a scene op
OT_SCENE_TEXT_SELECTION_COLORS; and ot_text_buffer_set_width_method. No
client code uses opentui-sys directly, so nothing names `reserved`, and
the opentui API the client calls is unchanged. The native library is in
~/.cache/opentui-native/cee1698ad/x86_64-linux, which
.cargo/config.toml names.
simonklee added a commit that referenced this pull request Nov 17, 2026
…nges late

OT/late-width (P-PTY) opens the home screen, then sends the DECRPM 2027
reply a terminal without grapheme clustering gives (mode 0), after
startup's wait, and types a thumb with a skin tone into the prompt that
already exists. With #2148 the prompt measures it as 4 cells and puts
its cursor there; @opentui/core 0.8.4, which TS runs, keeps the prompt's
startup width and puts the cursor 2 cells on. The screens are equal; the
cursor line differs, which OT2148-live-width-method records (O-89). On
the earlier pin the Rust prompt drew the thumb without its skin tone.
simonklee added a commit that referenced this pull request Nov 18, 2026
…hod)

c3a007e0d..cee1698ad is #2148 and #2149, which fix record 692: when the
terminal's replies (DECRPM 2027, XTVERSION) change the width method after
startup, the scene's text follows it, and so do Code, Input, Textarea and
TextTable, whose buffers keep their cursors, selections, marks, styled
runs and undo points on their text.

opentui.h changes (FNV-1a 64 0x99dd2d0018a6caa3, which generated.rs
names at cee1698ad): ot_edit_buffer_options's zero `reserved` word is now
`flags`, with OT_EDIT_BUFFER_FOLLOW_SESSION_WIDTH; a scene op
OT_SCENE_TEXT_SELECTION_COLORS; and ot_text_buffer_set_width_method. No
client code uses opentui-sys directly, so nothing names `reserved`, and
the opentui API the client calls is unchanged. The native library is in
~/.cache/opentui-native/cee1698ad/x86_64-linux, which
.cargo/config.toml names.
simonklee added a commit that referenced this pull request Nov 18, 2026
…nges late

OT/late-width (P-PTY) opens the home screen, then sends the DECRPM 2027
reply a terminal without grapheme clustering gives (mode 0), after
startup's wait, and types a thumb with a skin tone into the prompt that
already exists. With #2148 the prompt measures it as 4 cells and puts
its cursor there; @opentui/core 0.8.4, which TS runs, keeps the prompt's
startup width and puts the cursor 2 cells on. The screens are equal; the
cursor line differs, which OT2148-live-width-method records (O-89). On
the earlier pin the Rust prompt drew the thumb without its skin tone.
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