anomalyco / anomalyco/opencode
Opencode2 shell tool bypasses edit/write tool permission checks on blocked file paths
@jlongster is already working on this.
Since Jul 24, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
The edit and write tools enforce a permission check that blocks modification of files at paths requiring external_directory approval. However, the shell tool can achieve the same file modification (e.g. via sed, cat >>, python3) while its path-based warnings are advisory-only and do not block execution. This allows the model to bypass the permission layer by switching from a denied edit/write call to a shell call that performs the same operation.
Plugins
No response
OpenCode version
0.0.0-next-16116
Steps to reproduce
- Request a file modification that triggers
permission.rejectedoneditorwrite(e.g. editing a file where the path requires external_directory approval) - The
edittool is denied with"error":{"type":"permission.rejected","message":"Permission denied: edit"} - The model falls back to using
sed,cat,python3, or other file-modifying commands via theshelltool - The
shelltool succeeds despite operating on the same path, because its path check is advisory-only:"this scan is advisory only"
Screenshot and/or share link
No response
Operating System
Linux 6.18.35.2-microsoft-standard-WSL2 (archlinux x64)
Terminal
windows 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.