Repository navigation
fix(permissions): treat pathless host allows as any path and keep the host of host//path - #3831
Merged
Merged
Conversation
… host of host//path A pathless webfetch allow such as `example.com` names every path on that host, so it now overlaps a `*` restriction without a `/` such as `*.pdf` and is withheld. `stripUrlSchemeKeepingPathCase` strips a scheme only when a `:` precedes the `//` (or the prefix is `*` or empty), so `evil.com//x` keeps its host `evil.com`. The earlier reading is still compared in the overlap check, so the change only adds overlaps. Copilot in VS Code no longer rewrites such a restriction into a key like `"admin": false`; it withholds the `true` entries the restriction overlaps instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QUBBebviXSBQtiRAmDopZ7
# Conflicts: # src/generated/docs-content.ts
This was referenced Nov 12, 2026
Merged
superbiche
pushed a commit
to superbiche/rulesync
that referenced
this pull request
Nov 29, 2026
- 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 dyoshikawa#3831 review and compute the restriction actions and left-side glob tests once. Closes dyoshikawa#3822 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
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.
What
Fixes items 1 and 2 of #3822 in
src/features/permissions/shadowed-allows.ts, plus the matching change in the Copilot (VS Code) URL map.example.comnames every path on that host. WhenurlPatternsOverlapcompares the whole strings, it now also tries the allow as<host>/*against any restriction that has no/(*.pdf,*admin). With{"*":{"*.pdf":"deny"},"webfetch":{"example.com":"allow"}}, every adapter that withholds now withholdsexample.com. Only the allow side is widened, and only against restrictions without a/. Widening the restriction too would let.envoverlap*.github.com, and*://evil.com/*overlapgood.com, by matching through the*. Restrictions that contain a/are still compared host by host and path by path.host//pathread as a scheme.stripUrlSchemeKeepingPathCasenow strips a scheme only when a:comes before the//, or when the prefix is*or empty. Soevil.com//xkeeps its hostevil.com. The overlap check still compares the old reading too (the newstripUrlSchemeLoosely). That means the change can only add overlaps: under the old readingevil.com//xoverlappedx, and it still does."admin": false(fromEvil.com//Admin). It treats the restriction as one it cannot write, so it withholds everytrueURL entry the restriction overlaps under either reading (new helperhasDoubleSlashWithoutScheme).The
file-formats.mdparagraph on webfetch overlap is updated to match, anddocs-content.tsis regenerated.Items 3-12 are out of scope.
Can this make any generated config looser?
No. I checked this with real
generateruns, not only unit tests. For 16 probe inputs, I rantsx src/cli/index.ts generate -f permissions -t '*'in fresh scratch project dirs, once on the base commit and once on this branch. That covers every target that writes a file: 27 files per probe, including Codex, Cursor, Copilot VS Code/CLI, Grok, Vibe, Reasonix, Devin, CodeBuddy, Qoder, Qwen, Command Code, Pool, Antigravity, OpenCode, Kilo, Claude Code and others. Then I randiff -ron the two output trees.Probes: the two inputs from the issue;
askvariants; scheme and port allows (https://example.com,example.com:8080); in-category restrictions (webfetch: {"*.pdf": "ask", "*": "allow", ...});evil.com//xagainst allowsx,x/foo,https://x/,evil.com/z;Evil.com//Admindeny or ask againstevil.comand against*;*//evil.com/*,http*//bad.com,//worse.com,*://evil.com/*,https://bad.com/admin;*evil.com/*and*://bad.com/*againstgood.comand*.github.com;.envand*admintogether with*.github.com,example.comandexample.com/docs/*.Results:
"allow": []). No allow entry appears in any output that was not there before. No deny or ask entry turned into an allow.falseentries are the Copilot VS Code keys written from the old misreading ("x": false,"admin": false). In each case, everytrueentry that the restriction overlaps under either reading is now withheld. So no remainingtrueentry covers those hosts, and VS Code still prompts for them./(*://evil.com/*,*evil.com/*,https://bad.com/admin) produce identical output. Sogood.comand*.github.comare not over-withheld.Tests
urlPatternsOverlapcases:*.pdf/*adminvs.example.com;evil.com//xvs.evil.comand vs.x. Non-overlaps:.envvs.*.github.com,*://evil.com/*vs.good.com,*evil.com/*vs.good.com,evil.com//xvs.evil.com/z.stripUrlSchemeKeepingPathCasetable (scheme,http*://,*://,*//,//,Evil.com//Admin).honorAllToolsRestrictionsregression with both probe inputs from the issue.{"*":{"Evil.com//Admin":"deny"},"webfetch":{"evil.com":"allow","admin":"allow","good.com/z":"allow"}}writes only{"good.com/z": true}.All new tests fail on the base commit.
pnpm cicheckpasses locally.Refs #3822
🤖 Generated with Claude Code
https://claude.ai/code/session_01QUBBebviXSBQtiRAmDopZ7