You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Create a project with .opencode/opencode.json:
{
"permission": {
"grep": {
"": "allow",
"/config.php": "deny"
}
}
}
Create config.php with any content
Run: grep with "pattern": "any-string", "include": "config.php"
The config.php content is returned — no permission block
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.
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.
Activity
github-actions commentedon Jul 6, 2026
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.
Mac-Moneysac commentedon Aug 18, 2026
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.
neriousy commentedon Oct 1, 2026
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
denyrules for specific files don't filter results. Please follow and 👍 there.