Repository navigation
fix(permissions): withhold Crush safe commands shadowed by executable-path denies - #3867
Merged
dyoshikawa merged 2 commits intoNov 18, 2026
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
An active moderate finding remains because lowercasing the entire safe-command line makes case-sensitive arguments affect permission matching incorrectly.
1 open issue
What changed in this PR
This pull request hardens Crush permission generation so executable-path restrictions correctly withhold equivalent safe-command allows, preventing denied commands from being auto-approved.
Changes:
- Compares literal and wrapper safe-command spellings against Crush-normalized restrictions.
- Adds regression coverage for
/usr/bin/go builddenyinggo buildwhile preserving unrelated commands such ascargo test.
| File | Description |
|---|---|
| src/features/permissions/crush-permissions.ts | Extends safe-command shadow detection to compare literal and wrapper command spellings against normalized restrictions. |
| src/features/permissions/crush-permissions.test.ts | Adds regression coverage for executable-path denies withholding the corresponding safe command while preserving unrelated safe commands. |
Review effort: Lite
| uniq([ | ||
| ...withSeparator([line, ...wrapped(line)]).flatMap((spelling) => test(spelling)), | ||
| ...withSeparator(wrapped(line.toLowerCase())).flatMap((spelling) => | ||
| ...withSeparator([line.toLowerCase(), ...wrapped(line.toLowerCase())]).flatMap((spelling) => |
4 tasks
Owner
|
@jdotc1 Thank you! |
This was referenced Nov 19, 2026
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.

Addresses #3822 item 9 (Crush safe-command normalization). Other cases in the umbrella issue remain open.
Security fix
Crush normalizes executable names by removing their directory and lowercasing before comparing
safe_commands. As a result, a canonicalgo buildallow could previously survive an explicit/usr/bin/go builddeny, potentially auto-approving the denied command. Compare the literal safe command as well as wrapper spellings against restrictions normalized by Crush's own command-name rules, and withhold the unsafe allow.The change only withholds additional auto-allows; it never grants permissions. An unrelated
cargo testallow remains intact.Verification
pnpm exec vp test run src/features/permissions --silent=true— 2,870 passed across 59 files.pnpm run typecheck— passed.vp fmt --checkandvp lint --max-warnings 0on the changed files — passed.