Skip to content

fix: retire the Bash hook, which bypassed permission rules - #13

Merged
hardy30894 merged 1 commit into
mainfrom
fix-retire-bash-hook
Oct 23, 2026
Merged

hardy30894 merged 1 commit into
mainfrom
fix-retire-bash-hook

Conversation

@hardy30894

Copy link
Copy Markdown
Member

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 hook rewrote every Bash command to secondwind exec -c '<command>' and answered "permissionDecision": "allow". Two consequences for anyone who ran secondwind setup --hook:

  • Bash allow and deny rules no longer matched: a rule like Bash(rm:*) does not match secondwind exec -c 'rm -rf build'.
  • allow skipped the permission prompt for every Bash command.

There is no hook decision that rewrites the input and leaves the decision to the normal flow: ask prompts on every command, defer needs -p and ignores the rewrite, and omitting the decision is undocumented. The hook cannot be fixed, so it is retired. The Claude Code mod in integrations/claude-code compresses Bash output after the command has run and never touches permissions.

What

  • secondwind hook reads 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 --hook installs nothing and says so; plain secondwind setup removes a hook an earlier version installed, leaving any other hooks in place.
  • secondwind check warns when the retired hook is still installed.
  • Help text, the dashboard and the README no longer point to the hook.

secondwind exec is unchanged.

Tests

The hook answers a Bash event with nothing and exit 0; setup --hook installs nothing; setup removes a stale hook. cargo test -p secondwind: 24 passed. Clippy clean.

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.
@hardy30894
hardy30894 merged commit 73cb0e7 into main Oct 23, 2026
3 checks passed
@hardy30894
hardy30894 deleted the fix-retire-bash-hook branch October 23, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant