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
permission: broad deny overrides specific allow via findLast() semantics #37935
When a broad deny rule (e.g., $HOME/* → deny) appears in the same ruleset as a more specific allow (e.g., $HOME/utilities/* → allow), the evaluate() function uses findLast() which picks the last matching rule — regardless of pattern specificity. The broad deny silently overrides the specific allow, making it impossible to use the pattern "deny everything under a parent path except specific subdirectories."
This affects both V1 (packages/opencode/src/permission/index.ts) and V2 (packages/core/src/permission.ts) permission evaluation, and also means any "always" saved approvals under a broadly denied parent are effectively dead code.
This is how V2 is designed to work: the last matching rule wins (see the permissions docs). Put the broad rule first and the exception after it, e.g. "$HOME/": "deny" and then "$HOME/utilities/": "allow". A PR switching to most-specific-wins (#37936) was closed without merging.
Activity
github-actions commentedon Jul 20, 2026
This issue might be a duplicate of existing issues. Please check:
*Overwriting Lower Permissions — same root cause: a broad wildcard deny overrides a more specific allow rulefindLast()/ordering semantics problempermission.bashpattern maps: "*": "deny" fallback removes the bash tool from all agents; deny patterns under an allow fallback are ignored #36765:permission.bashpattern maps:"*": "deny"fallback removes the bash tool; deny patterns under an allow fallback are ignored — same family of ordering/specificity bugsIf your issue is distinct (e.g. you've identified a specific new code path or regression), please clarify the differences.
neriousy commentedon Oct 22, 2026
This is how V2 is designed to work: the last matching rule wins (see the permissions docs). Put the broad rule first and the exception after it, e.g. "$HOME/": "deny" and then "$HOME/utilities/": "allow". A PR switching to most-specific-wins (#37936) was closed without merging.