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
{{ message }}
Repository navigation
Sub-agents (Task tool) bypass deny permission rules for read and grep #32024
When a deny permission rule is configured in opencode.json for file reading (e.g., "**/.env": "deny"), sub-agents spawned via the task tool do not respect these rules. The sub-agent reads and returns the content of denied files without triggering any permission check or warning.
The main agent correctly respects these rules, but when the task tool is used to delegate work to a sub-agent, the sub-agent reads .env files freely and returns their full content to the parent agent — effectively bypassing the security restriction entirely.
Plugins
None
OpenCode version
1.16.2
Steps to reproduce
Configure ~/.config/opencode/opencode.json with "**/.env": "deny" under permission.read and permission.grep
Place a .env file in your project directory containing sensitive values
Ask OpenCode to search the repository for a specific string (e.g. a username)
OpenCode delegates the search to a sub-agent via the task tool
The sub-agent reads the .env file and returns the sensitive content to the parent agent, which then presents it to the user
Expected behavior: The deny rules should be inherited and enforced in all sub-agents spawned via the task tool.
Actual behavior: Sub-agents ignore deny rules and freely read/grep denied files.
This is the same root cause as #23519 but for read/grep instead of edit/write. PR #18761 by @OpeOginni appears to be working on standardizing permission path handling across all tools, which should fix both issues.
Activity
github-actions commentedon Jun 12, 2026
This issue might be a duplicate of existing issues. Please check:
If this is the same underlying problem, it may be worth consolidating with that issue.
JustSidus commentedon Jun 12, 2026
This is the same root cause as #23519 but for read/grep instead of edit/write. PR #18761 by @OpeOginni appears to be working on standardizing permission path handling across all tools, which should fix both issues.
github-actions commentedon Aug 12, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.