Skip to content

grep tool ignores per-pattern deny permission rules #35503

Closed as duplicate
Closed as duplicate

Description

@CryptoSiD

Description

Per-pattern permission rules defined under "grep" in opencode.json are not enforced.
Files set to "deny" in the grep rules still return their content when matched. The same pattern-based rules work correctly under "read" and "glob".

Expected behavior: grep should block matches inside files matching denied patterns, showing a permission denied message — the same way read and glob do.

Additional context: "read" and "glob" per-pattern rules work as expected with identical pattern syntax. The file include filter on grep appears to bypass the permission check entirely.

Plugins

None

OpenCode version

1.17.13

Steps to reproduce

  1. Create a project with .opencode/opencode.json:
    {
    "permission": {
    "grep": {
    "": "allow",
    "
    /config.php": "deny"
    }
    }
    }
  2. Create config.php with any content
  3. Run: grep with "pattern": "any-string", "include": "config.php"
  4. The config.php content is returned — no permission block

Screenshot and/or share link

No response

Operating System

Ubuntu 26.10

Terminal

Tabby

Activity

  1. github-actions commented on Jul 6, 2026

    @github-actions
    Contributor

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

    These issues report the same or closely related behavior where pattern-based deny rules in the permission config are not enforced at the tool level.

  2. Mac-Moneysac commented on Aug 18, 2026

    @Mac-Moneysac

    I hope that this fix/feature will be implemented somehow. Analogously to other agentic tools, read permissions could influence grep permissions implicitly, e.g. by filtering matches afterwards.

    However, permissions based on grep patterns is rather useless IMHO.

  3. neriousy commented on Oct 1, 2026

    @neriousy
    Member

    Closing as a duplicate of #17073, which tracks grep and glob not applying per-file permission rules. Permissions for these tools are checked against the search pattern, not against each matched file, so deny rules for specific files don't filter results. Please follow and 👍 there.

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