GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — New permission system issues with wildcards and glob patterns · Issue #7029 · anomalyco/opencode

New permission system issues with wildcards and glob patterns #7029

New issue
Copy link
New issue
Copy link
Closed
Closed
New permission system issues with wildcards and glob patterns#7029
Copy link
Assignees
thdxr
Labels
bugSomething isn't working

Description

@shanepadgett
shanepadgett
opened on Jan 6, 2026
Issue body actions

Description

Below is the frontmatter in one of my agents. You can see the intent here is to deny the ability to write to any file or edit any file outside of the specific folders and filetypes I've globbed. I already checked and found one issue in the code is likely that you are using minimatch for the pattern matching, but that main issue is if you set "*": deny the whole tool no longer works. Specific patterns should take precedence over wildcard denys.

---
name: sdd/plan
description: SDD planning and artifact authoring - specs, proposals, tasks, and plans
color: "#BFB8AD"
permission:
  edit:
    "changes/**/*.md": allow
    "*": deny
  write:
    "changes/**/*.md": allow
    "*": deny
---

Plugins

No response

OpenCode version

1.1.3

Steps to reproduce

Use the agent and see that it cannot write file to such a folder.

Screenshot and/or share link

No response

Operating System

macOS 26.1

Terminal

Ghostty

Activity

  1. shanepadgett
    added
    bugSomething isn't working
    on Jan 6, 2026
  2. github-actions
    assigned
    thdxr
    on Jan 6, 2026
  3. github-actions commented on Jan 6, 2026

    @github-actions
    github-actionsBot
    on Jan 6, 2026 – with GitHub Actions
    Contributor
    More actions

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

    • [BUG] Bash permission patterns with wildcards don't match commands with flags (e.g., "kill *" doesn't match "kill -9 PID") #6676: [BUG] Bash permission patterns with wildcards don't match commands with flags (e.g., "kill *" doesn't match "kill -9 PID") - Similar issue with wildcard pattern matching in permissions
    • MCP tool permissions not working after migration from tools to permissions #6892: MCP tool permissions not working after migration from tools to permissions - Related to the new permission system not working correctly
    • Should we actually implement the new granular permissions in .md agent files? #6856: Should we actually implement the new granular permissions in .md agent files? - Discusses implementation of granular permissions in agent frontmatter

    The core issue appears to be with how wildcard and glob patterns are processed in the new permission system, where specific patterns should take precedence over wildcard denies.

    Feel free to ignore if none of these address your specific case.

  4. malhashemi commented on Jan 6, 2026

    @malhashemi
    malhashemi
    on Jan 6, 2026
    Contributor
    More actions

    @shanepadgett I think it is about ordering see 6856

  5. rekram1-node commented on Jan 6, 2026

    @rekram1-node
    rekram1-node
    on Jan 6, 2026
    Member
    More actions

    @shanepadgett try:

    permission:
      edit:
        "*": deny
        "changes/**/*.md": allow
      write:
        "*": deny
        "changes/**/*.md": allow
    
  6. rekram1-node
    closed this as completedon Jan 6, 2026
  7. shanepadgett commented on Jan 6, 2026

    @shanepadgett
    shanepadgett
    on Jan 6, 2026
    Author
    More actions

    So switching the ordering at least allowed the write tool to be recognized, but glob patterns like my changes folder do not work still. So switching was an improvement, but when it tried to write a markdown file to changes folder it was denied.

  8. kylerm42 commented on Jan 7, 2026

    @kylerm42
    kylerm42
    on Jan 7, 2026
    More actions

    Just wanted to share my experience with this. The documentation does not make it clear that these read/edit/write permissions are relative to the workspace root, which is NOT always the directory you launch Opencode from. Opencode uses git rev-parse --git-common-dir to set the root, so patterns have to match from that directory.

    I had my agent set up like this:

      edit:
        "*": deny
        "test_dir*": allow
      write:
        "*": deny
        "test_dir/*": allow

    This is my setup that's problematic with those permissions:

    repo-root/                          [Git Root, Opencode worktree root]
    ├── test_dir/                       ✅ Pattern: test_dir/*
    │   └── file.md                        Can edit depending on external_directory permission
    │
    └── sub_dir/                        [Working Directory - where Opencode launches]
        └── test_dir/                   ❌ Pattern: test_dir/*
            └── file.md                    Does NOT match (full path is sub_dir/test_dir/*)
    

    So after figuring out what the issue is, I changed my permissions to this:

      edit:
        "*": deny
        "*/test_dir*": allow
      write:
        "*": deny
        "*/test_dir/*": allow
    

    Which leads to some other potential problems.

    repo-root/                          [Git Root]
    ├── test_dir/                       ❌ Pattern: */test_dir/*
    │   └── file.md                        Does NOT match (no prefix before test_dir)
    │
    └── sub_dir/                        [Working Directory - where Opencode launches]
        └── test_dir/                   ✅ Pattern: */test_dir/*
            └── file.md                    DOES match (sub_dir/ matches the */)
    External Repository (SECURITY ISSUE)
    =====================================
    /some/other/repo/                   [Different Git Root]
    └── any_dir/                        
        └── test_dir/                   ⚠️  Pattern: */test_dir/*
            └── file.md                    ALSO MATCHES! (any_dir/ matches the */)
    

    I think it's easy enough to manage the permissions now that I know, but it took a while to figure out and diving into the code to understand. My suggestions would be to 1. standardize external_directory permission (uses Instance.directory) and read/edit/write permissions (uses Instance.worktree), and 2. Update the permissions documentation to include a note about this. @rekram1-node

    @shanepadgett Not sure if this applies to your situation, but also wanted to point out that the wildcard matching is a simple one, not like glob patterns. So yours should let you edit changes/some_dir/test.md but wouldn't let you edit changes/test.md.

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

Metadata

Metadata

Assignees

  • @thdxr
    thdxr

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.