Repository navigation
fix: retire the Bash hook, which bypassed permission rules - #13
Merged
Merged
Conversation
Claude Code checks permission rules against the command a PreToolUse hook returns. The hook rewrote every Bash command to secondwind exec -c '...' and answered allow, so deny rules such as Bash(rm:*) no longer matched and the prompt was skipped. No hook decision rewrites a command while leaving the permission flow in charge, so the hook now answers with nothing and Claude Code runs the command as written. setup --hook installs nothing, plain setup removes a hook an earlier version installed, and check warns when one is still there. The Claude Code mod compresses Bash output after the command runs instead.
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.
Why
Claude Code evaluates permission rules against the input a PreToolUse hook returns, not the input the model sent (hooks reference, "PreToolUse decision control").
secondwind hookrewrote every Bash command tosecondwind exec -c '<command>'and answered"permissionDecision": "allow". Two consequences for anyone who ransecondwind setup --hook:Bash(rm:*)does not matchsecondwind exec -c 'rm -rf build'.allowskipped the permission prompt for every Bash command.There is no hook decision that rewrites the input and leaves the decision to the normal flow:
askprompts on every command,deferneeds-pand ignores the rewrite, and omitting the decision is undocumented. The hook cannot be fixed, so it is retired. The Claude Code mod inintegrations/claude-codecompresses Bash output after the command has run and never touches permissions.What
secondwind hookreads the event and prints nothing, so Claude Code runs the command as written under its own rules. Settings that still name the hook keep working.secondwind setup --hookinstalls nothing and says so; plainsecondwind setupremoves a hook an earlier version installed, leaving any other hooks in place.secondwind checkwarns when the retired hook is still installed.secondwind execis unchanged.Tests
The hook answers a Bash event with nothing and exit 0;
setup --hookinstalls nothing;setupremoves a stale hook.cargo test -p secondwind: 24 passed. Clippy clean.