You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
external_directory: "deny" gets bypassed depending on which bash command you use (macOS) #44728
Found something inconsistent with external_directory: "deny". Same external path, same config, but whether it gets blocked depends entirely on which command touches it.
head -1 /etc/hosts → just runs, dumps the content, no prompt at all
ls /etc/hosts → runs
ls /etc → runs, full directory listing
So cat gets stopped but head and ls walk right past the same deny rule on the same path. That shouldn't be possible — if external_directory is deny, it shouldn't matter which command is asking.
Related: #17497, #16126, #36681 - those are closed as not planned ("ask" case / Windows), this is different: "deny" on macOS, per-command inconsistency.
Plugins
none
OpenCode version
1.18.21
Steps to reproduce
Apply the config above in both the project opencode.json and ~/.config/opencode/opencode.jsonc, then clear the cache (rm -rf ~/.cache/opencode) and restart opencode.
Start opencode from /Users/<user>/myapp.
Ask the agent to run head -1 /etc/hosts → it executes and prints the content, no prompt, no block (BUG).
Ask the agent to run ls /etc → it executes and lists the directory (BUG).
Ask the agent to run cat /etc/hosts → blocked (correct — proves the config is enforced for some commands).
Ask the agent to read /etc/hosts with the read tool → blocked (correct).
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.
Activity
github-actions commentedon Aug 24, 2026
This issue might be a duplicate of existing issues. Please check:
external_directoryonly fires for a hardcoded list of bash command names, sohead,ls, and other unlisted commands bypass the check entirelyexternal_directorypermissionIf these cover your case, consider adding a "+1" reaction or additional context there rather than opening a new report.
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊