Repository navigation
fix(hooks): ensure default permission verdict prompts user for confirmation - #1173
Merged
FlorianBruniaux merged 1 commit intoApr 13, 2026
Merged
Conversation
iRonin
force-pushed
the
fix/hook-auto-allow-bypass
branch
from
April 10, 2026 17:49
d0fbae5 to
a839d59
Compare
iRonin
force-pushed
the
fix/hook-auto-allow-bypass
branch
from
April 10, 2026 17:54
a839d59 to
40462c0
Compare
FlorianBruniaux
approved these changes
Apr 13, 2026
FlorianBruniaux
left a comment
Contributor
There was a problem hiding this comment.
LGTM — security fix, reviewed diff, tests pass.
Closed
thehoff
pushed a commit
to thehoff/contextcrawler
that referenced
this pull request
May 14, 2026
thehoff
pushed a commit
to thehoff/contextcrawler
that referenced
this pull request
May 14, 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.
Summary
Verifies that
PermissionVerdict::Default(returned when no permission rule matches) correctly maps to exit code 3 (ask), NOT exit code 0 (auto-allow).Analysis
Reviewed three key files:
src/hooks/rewrite_cmd.rs— The match arm on line 37 already groupsDefaultwithAsk, both returning exit code 3. The code was already correct.src/hooks/permissions.rs—Defaultis properly documented as "no rule matched — default to ask" with least-privilege semantics..claude/hooks/rtk-rewrite.sh— Exit code 3 correctly omitspermissionDecision, forcing Claude Code to prompt the user.Changes
Added 6 comprehensive regression tests in
src/hooks/rewrite_cmd.rsunder a newexit_code_protocoltest module:test_default_verdict_maps_to_ask_exit_code— verifies Default → exit 3test_allow_verdict_maps_to_allow_exit_code— verifies Allow → exit 0test_ask_verdict_maps_to_ask_exit_code— verifies Ask → exit 3test_deny_verdict_maps_to_deny_exit_code— verifies Deny → exit 2test_no_auto_allow_bypass_for_unrecognized_commands— end-to-end security test for issue security: hook auto-allow bypasses agent permission model for rewritten commands #1155test_default_never_equals_allow— sentinel to catch enum changesAll tests include security-focused documentation referencing this issue.
Verification
All 1356 tests pass (6 new + 1350 existing), zero clippy warnings in modified files.