Repository navigation
fix(permissions): withhold allows shadowed by skipped ask and all-tools restrictions - #3802
Merged
Merged
Conversation
…ls restrictions Several permission translators let a canonical allow auto-approve an input that a stricter rule restricts (canonical order is deny > ask > allow): - Cursor, Vibe, Codex CLI (webfetch), TRAE (webfetch) and Copilot CLI (webfetch) skip ask rules but kept the allows covering them. A new withholdAllowsShadowedByAsks step withholds those allows (a catch-all allow falls back to the tool's prompt, Vibe's permission = "ask") and names them in a warning. Takt derives readonly from any ask, as from any deny. - Junie is first-match-wins, so every ask (including downgraded denies) is now written ahead of every allow in each group. - A pattern-specific deny/ask under the all-tools '*' category was honored only on bash. A shared honorAllToolsRestrictions step now withholds the covered allows in every category for the tools that cannot write such a rule, never emits a literal '*(<pattern>)' entry, and brings Reasonix, Qwen Code and Kimi Code the bash handling they lacked. OpenCode restates the restriction after the allows that would override it under last-match-wins. - Antigravity CLI/IDE withhold the allows of an action whose deny/ask they had to skip as unrepresentable. Found by the 2026-11-07 security audit (run-2): rulesync:permissions:ask-skipped-covering-allow-kept, rulesync:permissions:junie:first-match-wins-allow-emitted-before-restriction, rulesync:permissions:all-tools-restriction-honored-only-on-bash, rulesync:permissions:antigravity:unrepresentable-glob-deny-skipped-catchall-allow-kept. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179ZomNiDQHCzgoxeRVmfth
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179ZomNiDQHCzgoxeRVmfth
…ir own Cursor folds every per-tool MCP category into its Mcp surface and Antigravity into the mcp action, so an ask on one MCP tool withheld unrelated MCP tools' allows. Group MCP tool categories by category instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179ZomNiDQHCzgoxeRVmfth
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179ZomNiDQHCzgoxeRVmfth
Owner
Author
|
Review notes (batch triage, 2026-11-09). CI is green, but this is held back for now: it conflicts with Conflict.
Devin (#3816), Codex (#3817) and AugmentCode merge cleanly with no semantic interaction. Findings (from static review; the probes were not run locally):
|
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179ZomNiDQHCzgoxeRVmfth
Contributor
|
@dyoshikawa The CI checks on this pull request are currently failing. Please review the failing checks and push a fix. If you need help, leave a comment and a maintainer will follow up. |
…lows - OpenCode: restated '*' rules never land after an overlapping stricter rule. Asks come before denies, an own or '*' deny that overlaps a restated ask is moved after it, a '*' deny is restated over an overlapping ask too, and an ask under a key whose own catch-all denies is restated as a deny. - The overlap test widens '**/' and a trailing '/**' to '*', so '**/.env' overlaps '.env' and '**/*' overlaps everything (Antigravity no longer auto-approves '.env' reads). webfetch patterns are also compared lowercased and without a scheme. - Vibe, TRAE, Codex CLI webfetch and Crush now use honorAllToolsRestrictions, so a '*' deny/ask withholds the allows it covers (Crush keeps those tools out of allowed_tools; safe_commands/blocked_commands are unchanged). - A bash allow replaced by a same-pattern '*' ask is now named in the warning. - AugmentCode: document that a tool whose allows were all withheld gets the blanket all-tools fallback, and refresh stale comments in CodeBuddy, Command Code and Qoder about narrow '*' patterns. Docs list every adapter and state that a narrow '*' restriction also withholds catch-all allows. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QUBBebviXSBQtiRAmDopZ7
- Vibe: a withheld catch-all allow becomes permission = "ask", a '*' path deny is written into the denylist, and the allowlist entry or permission = "always" an earlier generate wrote for a withheld allow is removed. - Kilo shares OpenCode's last-match restatement (moved to last-match-restate.ts). OpenCode moves an own deny that absorbs a restated ask to the tail too. - The overlap test reads a trailing ' *' as optional and a brace alternation as overlapping everything; a pathless webfetch allow is also compared as its whole host (Codex CLI, TRAE). - Antigravity compares the scope the emitted target grants (path subtree, command word prefix, domain) against both skipped and '*' restrictions. - CodeBuddy, Qoder, Command Code, Letta Code and Qwen Code write '*' path/URL denies and asks as category rules (Read(.env)); Codex CLI copies '*' path restrictions into its filesystem rules; Copilot in VS Code writes '*' restrictions as false entries and honors them on the terminal map. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QUBBebviXSBQtiRAmDopZ7
- webfetch patterns are compared as URLs, host/port/path separately, so a host allow is no longer withheld by unrelated command or path restrictions, while a pathless restriction still covers every URL on its host. Shared by createCategoryShadowTest and Antigravity. - Codex CLI: '*' path asks land under read like a direct read ask (deny, and a narrower write allow they cover is denied); a catch-all '*' deny withholds every filesystem allow. - Copilot in VS Code: a catch-all '*' restriction is written as "*": false where it wins, URLs are restated lowercased without a scheme, and restrictions it cannot write withhold the true entries they overlap. - Vibe: a withheld catch-all under a catch-all '*' deny becomes permission = "never"; on-disk allowlist entries a current deny/ask covers are removed from managed tables. - Cursor, Reasonix, Qwen Code, Devin and Antigravity write '*(<pattern>)' deny/ask entries again, as main did. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QUBBebviXSBQtiRAmDopZ7
urlPatternsOverlap now also runs the whole-string glob comparison (widened as before, raw and lowercased without a scheme), so '*://evil.com/*', '*.pdf' or a brace alternation still withhold the webfetch allows they cover; only patterns with whitespace are exempt. A glob-spelled scheme is stripped before the part-wise comparison. Copilot in VS Code keeps the path case when restating into the urls map, and Vibe compares web_fetch allowlist entries as URLs when retiring them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QUBBebviXSBQtiRAmDopZ7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes four permission-translator findings from the 2026-11-07 security audit (run-2). In each one a generated config auto-approved an input that a stricter canonical rule restricts. The canonical order is
deny > ask > allow.askbeside a coveringallow(rulesync:permissions:ask-skipped-covering-allow-kept): Cursor, Vibe, Codex CLI (webfetch), TRAE (webfetch) and Copilot CLI (webfetch) have no ask tier there, so they skipaskrules. They still wrote the broader allow, though, e.g.Shell(git *)beside agit push *ask. The newwithholdAllowsShadowedByAsks(src/features/permissions/shadowed-allows.ts) withholds every allow anaskcovers. A catch-all*allow falls back to the tool's prompt instead: Vibe getspermission = "ask"instead of"always". A warning names each withheld allow. Takt now derivesreadonlyfrom anyask, as it already did from anydeny.rulesync:permissions:junie:first-match-wins-allow-emitted-before-restriction): each group now lists everyask(including denies downgraded toask) ahead of everyallow. The sort is stable.*restrictions honored only on bash (rulesync:permissions:all-tools-restriction-honored-only-on-bash): the new sharedhonorAllToolsRestrictionsstep handles a tool that cannot write a pattern-specific*deny/ask. In every category it withholds each allow the restriction covers, and it never writes a literal*(<pattern>)entry (Cursor, Reasonix, Qwen Code, Devin, Antigravity). It also gives Reasonix, Qwen Code and Kimi Code the bash handling they were missing. The catch-all*keeps its existing native handling wherever the tool writes one (Continue, AugmentCode, Grok CLI, Qoder, Command Code, CodeBuddy). OpenCode is last-match-wins, so the restriction is restated after the allows that would otherwise override it. The documented{"*": {"*": "ask"}, ...}default idiom is left untouched.rulesync:permissions:antigravity:unrepresentable-glob-deny-skipped-catchall-allow-kept): a deny/ask that Antigravity cannot express is skipped, and it now withholds the allows of the same action that cover it. Example:read_filebeside a skipped**/.envdeny.docs/reference/file-formats.mdis updated for each target, anddocs-content.tsis regenerated.Test plan
src/features/permissions/shadowed-allows.test.tsruns each audit payload through every affected adapter. 18 of its cases fail onorigin/mainwithout the translator changes.*deny.pnpm cicheckpasses, and so does the fullpnpm test:e2esuite (1518 tests).Follow-up fixes (review round)
OpenCode restatement no longer loosens anything. A restated
*rule never lands after an overlapping stricter one: the tail of a key is asks first, then denies, and an own or*deny that overlaps a restated ask is moved after it. A*deny is also restated over an overlappingask, not only anallow. Under a key whose own catch-all denies, the ask is restated as a deny. So{"*": {".env": "ask"}, "read": {"*": "allow", ".env*": "deny"}}still denies.env, and{"*": {".env": "deny"}, "read": {"*": "ask"}}ends withread .env deny.**/zero-segment gap. The overlap test widens**/and a trailing/**to*on both sides, so it can only report more overlaps, never fewer.{"*": {"**/.env": "deny"}, "read": {".env": "allow"}}and{"*": {".env": "deny"}, "read": {"**/*": "allow"}}no longer leave aread_fileallow on Antigravity.webfetchpatterns are also compared lowercased and without a scheme, in addition to the raw comparison.More adapters migrated. Vibe, TRAE, Codex CLI (
webfetchdomains) and Crush now go throughhonorAllToolsRestrictions, so a*deny/ask withholds the allows it covers, with the same warning. Crush keeps those tools out ofallowed_tools. Itssafe_commands/blocked_commandslogic from feat(permissions): map crush bash pattern rules to safe_commands and blocked_commands #3818 is unchanged and still ownsbash.AugmentCode. A tool whose allows were all withheld keeps getting the blanket all-tools
deny/askfallback rather than AugmentCode's own default. That default would run a read-only tool such asviewon the very input the restriction names, so this is now the documented behaviour, with updated warning text and comments and a test. Nothing becomes an allow.Visibility. When a
*ask of the same spelling replaces a bash allow, the warning now names it. The stale "narrower*patterns are shell restrictions" comments in CodeBuddy, Command Code and Qoder are updated.docs/reference/file-formats.mdlists every adapter. New adapter tests cover CodeBuddy, Command Code, Continue, Grok CLI, Letta Code, Kiropermissions.yamland AugmentCode.Round 2:
permission = "ask", and a*path deny is written into thedenylist. A staleallowlistentry orpermission = "always"left by a withheld allow is removed.last-match-restate.ts). OpenCode also moves an own deny of the same spelling that absorbs a restated ask to the tail.*is read as optional and a{a,b}alternation as overlapping everything. A pathlesswebfetchallow is also compared as its whole host, which covers Codex CLI and TRAE..as the whole workspace, command word prefix, domain) against both skipped and*restrictions.*path/URL denies and asks as category rules (Read(.env)), so a withheld read no longer falls back to an auto-approving default.*path denies into its filesystem table as"<pattern>" = "deny", and path asks as read-only access. This only happens when a filesystem category is stated and the pattern has no whitespace, so the sandbox only gains restrictions.*restrictions asfalseentries (terminal map, and the edits/URL maps when they read as a path/URL).Round 3:
webfetchpatterns are compared as URLs (lowercased, scheme stripped, host/port/path compared separately; a pathless pattern covers every URL on that host and its subdomains). Unrelated restrictions such asrm -rf *orexample.org/private/*no longer withhold agithub.comallow, whileevil.examplestill covershttps://evil.example/*. Antigravity uses the same comparison.*path asks land underreadlike a direct read ask, so they becomedenyand also deny a narrower write allow they cover. A catch-all*deny withholds every filesystem allow.*restriction is written as"*": falsewhere it wins. URLs are restated lowercased and without a scheme. A restriction that cannot be written into the map withholds thetrueentries it overlaps.permission = "never"under a catch-all*deny. On-diskallowlistentries that a current deny/ask covers are removed from managed tables.*(<pattern>)entries: Cursor, Reasonix, Qwen Code, Devin and Antigravity write*(<pattern>)deny/ask entries again, asmaindid. No primary source shows these tools read a*tool name literally, and an entry that never matches is harmless.Round 3 follow-up: URL patterns are also compared as whole strings, so
*://evil.com/*,*.pdfand brace alternations still withhold what they cover; only whitespace patterns are exempt. Copilot in VS Code keeps the path case in restated URLs, and Vibe comparesweb_fetchallowlist entries as URLs.🤖 Generated with Claude Code
https://claude.ai/code/session_01QUBBebviXSBQtiRAmDopZ7