anomalyco / anomalyco/opencode
external_directory: "deny" gets bypassed depending on which bash command you use (macOS)
@kitlangton is already working on this.
Since Aug 24, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Found something inconsistent with external_directory: "deny". Same external path, same config, but whether it gets blocked depends entirely on which command touches it.
Config (project and global, identical):
{
"permission": {
"bash": {
"*": "deny",
"ls *": "allow",
"cat *": "allow",
"head *": "allow",
"tail *": "allow",
"grep *": "allow",
"rg *": "allow",
"find *": "allow"
},
"external_directory": "deny"
}
}
Running opencode from /Users/<user>/myapp:
readtool on/etc/hosts→ blocked ✓cat /etc/hosts→ blocked ✓head -1 /etc/hosts→ just runs, dumps the content, no prompt at allls /etc/hosts→ runsls /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.jsonand~/.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/hostswith thereadtool → blocked (correct).
Screenshot and/or share link
Operating System
Mac Os Ventura 13.6.6
Terminal
Apple Terminal
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.