Skip to content

feat: add per-level ask mode for hooks#12

Open
enzoleonardi wants to merge 1 commit into
karanb192:mainfrom
enzoleonardi:main
Open

feat: add per-level ask mode for hooks#12
enzoleonardi wants to merge 1 commit into
karanb192:mainfrom
enzoleonardi:main

Conversation

@enzoleonardi
Copy link
Copy Markdown

Summary

  • Add configurable ASK mode per security level (critical, high, strict) to both block-dangerous-commands.js and protect-secrets.js
  • When ask=true for a level, the hook returns permissionDecision: "ask" instead of "deny", letting Claude Code prompt the user with context instead of blocking outright
  • Defaults to false (deny) for all levels; users can override via env vars (HOOK_ASK_CRITICAL, HOOK_ASK_HIGH, HOOK_ASK_STRICT) in their settings.json command
  • Remove 5 duplicate secrets-related patterns from block-dangerous-commands.js (cat-env, cat-secrets, env-dump, echo-secret, rm-ssh) to avoid conflicts with protect-secrets.js which is the single owner for all secrets patterns

Test plan

  • All 268 tests pass (npm test)
  • Verified ASK defaults are all false
  • Verified env var override works (e.g. HOOK_ASK_HIGH=true node script.js)
  • Verified no pattern conflicts between the two scripts
  • Integration tests confirm deny for critical/high and correct decision routing

🤖 Generated with Claude Code

Add ASK config (per security level) to both pre-tool-use hooks.
When ask=true for a level, the hook returns "ask" instead of "deny",
letting Claude Code prompt the user instead of blocking outright.
Defaults to false (deny) for all levels; override via env vars
HOOK_ASK_CRITICAL, HOOK_ASK_HIGH, HOOK_ASK_STRICT.

Remove 5 secrets-related patterns from block-dangerous-commands
(cat-env, cat-secrets, env-dump, echo-secret, rm-ssh) to avoid
conflicts with protect-secrets which owns all secrets patterns.
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