fix(security): SecurityValidator schema mismatch + fail-closed (#1014)#1028
Open
justinkatz94-glitch wants to merge 1 commit intodanielmiessler:mainfrom
Open
Conversation
…lmiessler#1014) Three security fixes: 1. decision:'ask' fails CC Zod validation (only accepts 'approve'|'block') - Changed to hookSpecificOutput with permissionDecision:'ask' - Every confirm-level control was silently non-functional 2. Five error paths fail-open (continue:true) instead of fail-closed - Now use process.exit(2) which CC treats as blocking denial 3. Added extractWritePathsFromBash() for deeper command analysis - Catches writeFileSync, shell redirections, tee, sed -i, cp/mv Closes danielmiessler#1014
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
Fixes three security vulnerabilities in SecurityValidator.hook.ts:
decision: 'ask'schema mismatch: CC's Zod schema only acceptsapprove|blockfor top-leveldecision. Changed tohookSpecificOutputwithpermissionDecision: 'ask'which IS validated. Every confirm-level security control (force push, recursive delete, cloud ops) was silently non-functional.{continue: true}. Now useprocess.exit(2)(CC treats exit code 2 as blocking denial).extractWritePathsFromBash(): Catches write operations hidden inside Bash commands (writeFileSync, shell redirections, tee, sed -i, cp/mv).Test plan
ls,cat) still return{continue: true}exit(2)git push --force) output validhookSpecificOutputJSONexit(2)(fail-closed)Closes #1014
🤖 Generated with Claude Code