Conversation
`Action::Default` had the lowest priority (0), so when an allowed sub-command (e.g. `echo test` inside `$()`) was merged with an unmatched outer command, Allow always won. This meant `gh pr edit 10 --body "$(echo test)"` was incorrectly allowed when only `echo *` had an allow rule. Remove `Action::Default` entirely and resolve unmatched commands to concrete actions at evaluation time using `defaults.action` (falling back to Ask). This ensures unmatched sub-commands participate in priority comparison at their effective restriction level. Also fix wrapper candidate selection to prefer rule-matched candidates over unmatched ones, and simplify adapter dispatch by removing the `Dispatch` enum and `resolve_no_match`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the security and predictability of rule evaluation, particularly for compound commands and command substitutions. By removing the ambiguous Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #178 +/- ##
==========================================
- Coverage 89.94% 89.86% -0.08%
==========================================
Files 38 38
Lines 7248 7212 -36
==========================================
- Hits 6519 6481 -38
- Misses 729 731 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
When `defaults.action = deny` and no rule matches, `default_action()` creates a `DenyResponse` with an empty `matched_rule`. The exec adapter printed "runok: denied: " (with nothing after the colon) and the hook adapter produced "denied: " as the reason field—both are uninformative compared to the previous "command denied by default policy" message from `handle_no_match`. Show "command denied by default policy" when `matched_rule` is empty, preserving the user-facing message quality. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The nested if/else chain for selecting the best wrapper candidate was harder to read than necessary. Tuple comparison (cand_matched, prio) naturally encodes the two-level priority: prefer rule-matched candidates first, then pick the most restrictive among them. Also revert the DenyResponse message added in the previous commit, keeping message: None to avoid duplicate "command denied by default policy" output (adapter layer already handles empty matched_rule). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The docs still referenced the removed Action::Default variant and its priority level. Update priority model, compound commands, wrapper recursion, and overview pages to reflect the new behavior where unmatched commands resolve to defaults.action (defaulting to ask) at evaluation time. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Why
$()) containing an allowed command could bypass rule controls for the entire compound commandgh pr edit 10 --body "$(echo test)"was incorrectly allowed when onlyecho *had an allow rule, because the Allow fromecho testpropagated to the entire compound despitegh pr edithaving no matching ruleAction::Defaulthad the lowest priority (0), so it always lost to Allow (1) during mergeWhat
Action::Defaultand resolve unmatched commands to concrete actions at evaluation time usingdefaults.action(falling back to Ask)Dispatchenum andresolve_no_matchfrom the adapter layer to simplify dispatch logic