Skip to content

glob tool ignores permission rules for path parameter (external drives/paths) #25268

Closed as not planned

Description

@oobma

Description

Permission rules configured in opencode.json are not enforced on the glob tool when paths are provided via the path parameter. Other tools (read, bash, grep, edit) correctly respect these rules.

Plugins

No response

OpenCode version

1.14.31

Steps to reproduce

  1. Configure opencode.json with permission rules to deny access to specific paths (e.g., external drives on Windows):
    {
    "$schema": "https://opencode.ai/config.json",
    "permission": {
    "glob": {
    "": "allow",
    "D:/": "deny",
    "E:/
    ": "deny",
    "D:
    ": "deny",
    "E:*": "deny"
    },
    "external_directory": {
    "D:/": "deny",
    "E:/
    ": "deny"
    }
    }
    }
  2. Restart opencode to load the new config.
  3. Attempt to glob files on the restricted drives:
    glob with path="D:" pattern=""
    glob with path="E:" pattern="
    "

Expected behavior:
The glob tool should be blocked by the permission rules, same as read and bash are. The glob tool receives the target directory via the path parameter, and permission rules should match against it.
Actual behavior:
The glob tool returns results from D:\ and E:\ without being blocked. The permission rules for glob only match against the pattern parameter, not the path parameter, so they are ineffective for restricting access to specific directories.
Other tools work correctly:

  • read with D:\ → correctly blocked ✅
  • bash with ls D:\ → correctly blocked ✅
  • glob with path="D:" → returns results ❌
    Environment:
  • OS: Windows 11
  • OpenCode version: (latest)
  • The external_directory rule also does not block glob access to paths outside the working directory.
    Suggested fix:
    The glob permission rules should check both the pattern and the path parameter, similar to how read and edit check their filePath parameter. Additionally, external_directory should also be enforced when glob is called with a path outside the project working directory.

Screenshot and/or share link

No response

Operating System

windows 11

Terminal

windows terminal

Activity

  1. added
    bugSomething isn't working
    on May 1, 2026
  2. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 1, 2026
  3. github-actions commented on May 1, 2026

    @github-actions
    Contributor

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

    If your issue is distinct from these (specifically the path parameter of the glob tool not being checked against permission rules, as opposed to the pattern matching itself), please clarify the difference.

  4. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  5. github-actions commented on Jul 3, 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