anomalyco / anomalyco/opencode

Permission from opencode.json are ignored on /init command

Open
#49,180 2 comments 0 reactions 1 assignee View on GitHub

@neriousy is already working on this.

Since Sep 15, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

Deny-rules from the opencode.json config are ignored when running the /init command in a directory - env files are read regardless of whether the user allowed the agent to or not.

Plugins

No response

OpenCode version

1.18.31

Steps to reproduce
  1. Setup an opencode.json in $HOME/.opencode/opencode.json
  2. Setup deny-rules on .env-files (example config below)
  3. run opencode in any directory containing a .env file
  4. watch opencode list files via ls -la followed by immediately cat ing the .env file

Example opencode.json used in testing

{
  "$schema": "https://opencode.ai/config.json",
  "permission": {
    "read": {
      "*": "allow",
      "*.env": "deny",
      "*.env.*": "deny",
      "*.env.example": "allow"
    },
    "grep": {
      "*": "allow",
      "*.env": "deny",
      "*.env.*": "deny",
      "*.env.example": "allow"
    },
    "glob": {
      "*": "allow",
      "*.env": "deny",
      "*.env.*": "deny",
      "*.env.example": "allow"
    }
  }
}
Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

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.