Hunter Bown
02fc16e10f
style: clippy sweep across community PRs (-D warnings)
...
13 clippy errors had accumulated from squash-merged community PRs:
collapsible-if (10), needless-late-init (1), derivable-impls (1),
sort-unstable hint (1). All auto-fixable mechanical lints — no
behaviour change. Required to satisfy CI's
`cargo clippy --workspace --all-targets --all-features --locked
-- -D warnings` gate.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-05-05 02:15:16 -05:00
wangfengcsu
9dea4ed256
feat(execpolicy): bash arity dictionary for command-prefix allow rules ( closes #410 )
...
Add `crates/execpolicy/src/bash_arity.rs` with a hand-curated `BashArityDict`
struct (160+ entries, 30+ command families: git, npm, yarn, pnpm, cargo,
docker, kubectl, go, pip, gh, rustup, deno, bun, aws, terraform, helm, make).
Wire arity-aware prefix matching into:
- `crates/tui/src/command_safety.rs` — new public `prefix_allow_matches()`
function so `auto_allow = ["git status"]` matches `git status -s` /
`git status --porcelain` but NOT `git push`.
- `crates/tui/src/execpolicy/rules.rs` — `ExecPolicyConfig::evaluate()` now
checks allow rules via `prefix_allow_matches` before falling back to the
existing regex/wildcard `pattern_matches` path.
- `crates/execpolicy/src/lib.rs` — `ExecPolicyEngine` uses `BashArityDict`
for trusted-prefix matching; backward-compatible with existing exact-match
deny rules.
`cargo +nightly check` passes. 0 errors, 0 warnings.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-05-04 16:28:42 -07:00
wangfengcsu
210540dbb6
feat(execpolicy): layered permission rulesets — defaults+agent+user ( closes #415 )
...
Add RulesetLayer enum (BuiltinDefault < Agent < User) and Ruleset struct
so the engine can stack multiple named permission layers. Higher-priority
layers shadow lower ones; within a layer, longest matching prefix wins.
- ExecPolicyEngine::with_rulesets() builds from explicit layers
- add_ruleset() inserts and re-sorts by priority
- resolve_prefixes() merges all layers + legacy flat lists
- Existing new(trusted, denied) constructor unchanged — backward compatible
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-05-04 16:25:44 -07:00