Repository navigation
refactor(permission): express protected paths as shipped rules - #793
Merged
Merged
Conversation
Protected paths duplicated the ask-tier `edit` rule: their own name tables and matcher, home locations, resolved roots with their own alias respelling, a `protected` field on every path target, `Policy::protected_group` at two call sites, and a `Policy.enabled` list that repeated the `builtin` tags of the shipped entries. Each shipped group now returns its rules with their tiers. A protected name becomes a built-in `edit` rule that matches it at any depth on disk, a directory with everything below it and a file only where a path ends in it, plus a copy anchored under each workspace root whose prefix the policy resolves, so a symlinked `.vscode` still protects its target. Home locations become absolute patterns, and `ssh` holds both its read deny and its edit ask. `rm` stays the one custom check, kept as a `bool` on the policy, and `config_fix` turns a group off by dropping its entries. The design doc drops the Protected zone, which the code never had.
Compile protected names through the same parser and matcher as configured rules. The portable /**/ form spans POSIX, drive, and UNC roots and retains recursive-reader coverage without projecting an arbitrary root. Protect descendants of directories named like config files too. Keep configured asks first and unrecognized-command rewrite guidance ahead of shipped asks.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
Protected edits used a separate name matcher and cached protected-root list alongside ordinary permission rules. Shipped ask-tier edit rules now share the configured-rule parser, folded-name matching, and symlink-prefix handling.
rmcheck remain intact./**/matches beneath POSIX roots, drives, and UNC shares without a literal anchor. Recursive readers account for possible matches beneath any root. Other drive-less rooted patterns still fail on Windows..bashrcor.claude/settings.json.yoloand match once before other ask conditions. Unrecognized syntax supplies rewrite guidance before shipped ask groups. An unrecognized device write names that syntax while retaining its Ask decision.Test plan
cargo fmt --check,cargo build, both Clippy runs,cargo doc --no-deps, andcargo llvm-cov --show-missing-lines: pass. 3,495 tests pass, five existing paid live tests remain ignored, and overall line coverage is 99.24%.yoloregressions pass. A viable mutation that skips configured asks inyolofails at runtime, then passes after restoring the source.pnpm format,pnpm lint,pnpm spellcheck, and all applicable commit and push hooks: pass.cargo deny checkwas omitted because dependencies are unchanged.