Repository navigation
fix(permissions): close the remaining all-tools withholding gaps (#3822) - #3987
Merged
Merged
Conversation
- Restate '*' path restrictions as Read rules even without a read category in CodeBuddy, Qoder, Command Code, Letta Code and Qwen Code, keeping existing entries of that category. - Respell integer-like deny/ask keys a later looser rule overlaps as '<n>*' at the key's end for OpenCode-family last-match-wins tools. - Skip Codex's default .git carve-out when a '*' deny covers .git. - Write the '*' catch-all restriction into Vibe categories. - Add the tests from the #3831 review and compute the restriction actions and left-side glob tests once. Closes #3822 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
- OpenCode V2 moves integer-like restrictions to the end of the ordered permissions array as written; only object-form outputs respell them. - Codex drops the .git carve-out when any '*' path deny/ask names a path in .git, compared with all-tools glob semantics. - Vibe restates the '*' restrictions into an absent read category too. - Reword the CodeBuddy, Qoder and Letta '*' warnings and add item-5 adapter tests for every restating tool. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…rmission-gaps # Conflicts: # src/generated/docs-content.ts
Drop the default carve-out only when a '*' deny/ask matches a concrete path git writes (case-insensitively), so common patterns such as *.env, *.log or **/*.pem no longer break git commit in Codex while .git/hooks/**, .g* and **/.git/** still drop it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…rmission-gaps # Conflicts: # src/generated/docs-content.ts
… Codex Drop the default .git carve-out when a '*' deny/ask's first path segment (after ./, / or **/) matches .git, or when it matches a concrete path git writes (now including submodule, worktree, info and ref files), so .git/hooks, .git/modules/**, .git/info and the like are no longer reopened while *.env, *.log and **/*.pem keep the carve-out. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…rmission-gaps # Conflicts: # src/generated/docs-content.ts
…rmission-gaps # Conflicts: # src/generated/docs-content.ts
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
Closes the remaining items of #3822 (permission-withholding gaps left after #3802). Every behaviour change here only adds a restriction or withholds more. No allow is added or widened.
Changes
Tests and cleanups (triage plan)
shadowed-allows.test.ts: a truth table forhasDoubleSlashWithoutScheme. Overlap cases from the fix(permissions): treat pathless host allows as any path and keep the host of host//path #3831 review:https://example.com,example.com:8080andexample.com/docs/*overlap*.pdf, while the path allowsexample.com/a.htmlandexample.com/docs/are not widened.copilot-permissions.test.ts: the edits map still gets"Evil.com//Admin": falsefrom a*deny.honorAllToolsRestrictionsnow looks upallToolsRules[pattern] ?? "deny"once and reuses it for bash and the other categories.last-match-restate.tsbuilds each left-side glob test once per pattern instead of once per pair. Neither change alters behaviour.Item 5: restate into an absent
readcategory. CodeBuddy, Qoder, Command Code, Letta Code and Qwen Code now also write a*path deny/ask as aRead(...)rule when the config has noreadkey. So{"*":{".env":"deny"},"bash":{"ls":"allow"}}now writesRead(.env). This uses the newrestateIntoAbsentCategoriesoption (RESTATED_ABSENT_CATEGORIES = ["read"]).Item 6 (rest): integer-like keys in OpenCode / OpenCode V1 / MiMo Code / Kilo. A JSON object always lists an integer-like key such as
8080first. That holds both when rulesync writes the file and when the tool parses it, so the key cannot be reordered. If a looser rule later in the same key overlaps such a deny/ask, the pattern is now written as8080*at the end of the key, with a warning. A respelled ask is placed before any deny it overlaps, the same tail order that restated*rules already use. This also covers an integer-like*restriction restated into another key.Item 7: Codex
.gitcarve-out. The default".git/**" = "write"is now skipped, with a warning, when a*path deny (or an ask there other than the catch-all) reaches inside.git. That means either its first path segment, after stripping./,/or**/, matches.git(for example.git/hooks,.git/modules/**,.g*/x,**/.git/**,*,**), or it matches a concrete path git writes under the all-tools glob rules (*crosses/): index, HEAD, config, objects, refs, hooks, logs, submodule and worktree files. Both checks ignore case. Before this change, even{"*":{".git/**":"deny"}}produced".git/**" = "write".Item 8: Vibe under a catch-all
*restriction. Each stated category without a*rule of its own now gets the catch-all restriction. So{"*":{"*":"deny"},"read":{"src/**":"allow"}}writesread_filewithpermission = "never"instead of leaving Vibe's default. This happens throughdowngradeWithheldCatchAll, which only Vibe uses.Docs:
docs/reference/file-formats.mdanddocs/faq.mdare updated, andsrc/generated/docs-content.tsis regenerated.Review round 1 follow-ups
permissionsarray, so an integer-like deny/ask is now moved to the end of its key's rules as written (no8080*, no warning). The8080*respelling applies only to the object-form maps (OpenCode V1, MiMo Code, Kilo). Both paths shareorderIntegerLikeRestrictionsLast..gitcheck, refined in rounds 2 and 3: a hybrid of a first-segment test and a list of concrete git-written paths. Every spelling inside.gitdrops the carve-out, including.git/hooks,.git/hooks/,.git/modules/sub/hooks/**,.git/worktrees/**,.git/info,.git/packed-refs,.git/FETCH_HEAD,.git/refs,.git/objects,.git/lfs/**,.git/rr-cache/**and.GIT/hooks/**. Broad patterns (*.env,*.log,**/*.pem,*secret*,.github/**,.gitignore) keep it, sogit commitkeeps working. Both lists are tested exhaustively.readcategory, including the catch-all:{"*":{"*":"deny"},"bash":{"ls":"allow"}}now writesread_filewithpermission = "never".*rule is "skipped"; they say how it is honored instead. Added item-5 adapter tests for all five tools (restatedRead(.env), hand-written entries kept).Design decisions
read, and the category stays unmanaged. The issue names reads as the input those tools may auto-approve. Edit, write and webfetch prompt by default, so restating there would only add noise. The adapters do not add a category tomanagedCategorieswhen it was only restated from*. Otherwise its existing hand-writtenRead(...)entries would be dropped, and dropping a hand-written deny would loosen the file. Trade-off: if the*deny is later removed, the restatedRead(...)entry stays as a stale but stricter entry. Qwen already computed managed tools from the config keys, so it needed no adapter change.allow. Downgrading the later rule (*: allowtoask,*: asktodeny) would change far more inputs.8080*covers8080plus the inputs that start with it: the restriction gets wider and no allow does. A key is rewritten only when a later looser rule actually overlaps it.{"*":{"*":"deny"}}: not restated, declined. In OpenCode a*catch-all followed by per-tool rules is the documented way to set a default, and{"*":{"*":"ask"},"read":{"*":"allow"}}is a deliberate, common config. Restating the catch-all would override every per-tool rule. That matches how the tools that write a*catch-all natively are handled (writesAllToolsCatchAll). The behaviour is now documented.*path deny/ask drops the carve-out when its first segment, after stripping./,/or**/, can be.git, or when it matches a path git writes, since such a restriction may reach nowhere else in the Codex profile. A plain overlap test would also drop it for broad patterns like*.envand breakgit commitin Codex. A pattern whose first segment is a pure wildcard (*/x) also counts, because it can name.git/x; that is conservative. Command patterns and a catch-all*ask are ignored. If the carve-out is dropped, it can be restored with explicitread/edit.git/**allows, or the warning silenced withcodexcli.git_write_rules: false.downgradeWithheldCatchAll. The catch-all is written only when it is stricter than the category's own*rule.Skipped items and why
Verification
rulesync generate -f permissionson probe configs for each changed target (output checked by hand), including a second generate over existing settings that hold hand-writtenRead(...)entries: they are kept, with no duplicates.pnpm check,pnpm testandpnpm cicheck:contentpass. Under heavy machine load, two time-budget tests (glob.test.ts,shell-command-categories.test.ts) and one real-Bun hook test timed out during the full run; the two budget files passed when rerun on their own. Neither file is touched by this PR.Closes #3822
🤖 Generated with Claude Code
https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4