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 rules use first-match-wins instead of documented last-matching-rule-wins #31854
Rules are evaluated by pattern match, with the last matching rule winning. A common pattern is to put the catch-all "*" rule first, and more specific rules after it.
However, the actual implementation uses first-matching-rule-wins. This means the documented "common pattern" of putting "*": "deny" first with specific "allow" overrides after it never works — the catch-all always takes priority.
Example
{
"edit": {
"*": "deny",
"Docs/*": "allow"
}
}
Expected per docs: editing Docs/foo.md is allowed (last match Docs/* → allow)
Actual: editing Docs/foo.md is denied (first match * → deny)
Workaround
List allow rules before deny rules, and avoid using a catch-all "*" entirely:
{
"edit": {
"Docs/*": "allow",
"*.cs": "deny"
}
}
This happens to work because the first match (allow) wins, but it contradicts the documented behavior.
Activity
github-actions commentedon Jun 11, 2026
This issue might be a duplicate of existing issues. Please check:
*overwriting more specific permission rules, contradicting the documented last-matching-rule-wins behaviorIf your issue is distinct or adds new information, feel free to clarify.
ro-mak commentedon Jun 11, 2026
I have the same issue in OpenCode CLI 1.17.3 macos version
github-actions commentedon Aug 11, 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.