Skip to content

Granular permissions not working (or documentation bad?) #20307

Closed as not planned

Description

@mindplay-dk

Description

Here's what I'm doing:

Image

As you can see, the read permission for * is set to ask, and for src/* it's set to allow.

Yet for some reason, it's prompting me to read src/App.tsx.

The patterns are simple enough, and I'm pretty sure I'm doing what the docs suggest:

Image

I don't have a global config - this is a project config in opencode.json in the root of the project.

opencode debug config confirms this is the only config file being read.

opencode debug agent plan confirms the permissions have been applied.

I'm unsure about the meaning of the order of the rules? I noticed it's an array in the output from opencode debug agent - does the order matter? I asked people on the Discord, and they seemed to think it does - but this being a .json file, I can't see how the order would even be available to OpenCode? The order of object properties in JS is undefined.

According to the docs:

Rules are evaluated by pattern match, with the last matching rule winning.

This seems to imply the order matters?

Yet, in the same sentence:

A common pattern is to put the catch-all "*" rule first, and more specific rules after it.

Which seems to imply it doesn't matter, and specificity is what matters.

But what makes a rule more or less specific? The length of the matched pattern? It's not explained.

I've looked at all of the following issues:

#4642
#7029
#7554
#6856

Apparently there's been a lot of issues and changes and confusion?

Yet, I still can't find an explanation, and still can't seem to come up with a working configuration.

Plugins

none

OpenCode version

1.3.10

Steps to reproduce

You can try my config file if you like:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "stepfun/step-3.5-flash:free",
  "autoupdate": true,
  "permission": {
    "*": "ask",
    "list": "allow",
    "grep": "allow",
    "glob": "allow",
    "read": {
      "*": "ask",
      "src/*": "allow"
    },
    "edit": {
      "*": "ask",
      "src/*": "allow"
    },
    "lsp": "allow",
    "question": "allow",
    "skill": "allow",
    "bash": {
      "*": "ask",
      "git *": "deny"
    }
  }
}

Screenshot and/or share link

No response

Operating System

Zorin OS 18 (Ubuntu based)

Terminal

VS Code terminal

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 31, 2026
  2. github-actions commented on Mar 31, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  3. jumski commented on Apr 4, 2026

    @jumski

    I observe the same issue! It was not happening on 1.2.27, seems related to the permission system rework

  4. molguin92 commented on Apr 10, 2026

    @molguin92

    I am struggling with the same issue. I want to limit certain agents to only be able to modify files in certain directories, but the permission system does not seem to work at all for this.

  5. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  6. draxxris commented on May 14, 2026

    @draxxris

    I am experiencing the same thing, it wasn't happening a month ago. This used to work for my agent config. Now the LLM gets denied no matter what.

    ---
    name: Architect
    description: Agent for creating an implementation plan document
    mode: primary
    permission:
      bash:
        "mkdir -p plans": allow
      edit:
        "*": deny
        "plans/*.md": allow
    
    ---
    
  7. github-actions commented on Jul 13, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions