anomalyco / anomalyco/opencode

Opencode2 shell tool bypasses edit/write tool permission checks on blocked file paths

Open
#38,664 1 comment 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Jul 24, 2026.

2.0
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
  1. Request a file modification that triggers permission.rejected on edit or write (e.g. editing a file where the path requires external_directory approval)
  2. The edit tool is denied with "error":{"type":"permission.rejected","message":"Permission denied: edit"}
  3. The model falls back to using sed, cat, python3, or other file-modifying commands via the shell tool
  4. The shell tool 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.