feat(security): bash command security + auto-allow hardening#22
Merged
Conversation
Compound command splitting: add split_bash_command() in Perl that tokenizes Bash commands respecting quotes, subshells, and backticks, then splits by unquoted |, &&, ||, ;, & operators. Redirections are stripped from each segment. For deny rules, ANY segment match denies the whole command. For allow rules, ALL segments must be covered. Read-only auto-allow: mirror CC's readonly command list and safety regex pattern. Simple commands (cat, head, tail, wc, stat, etc.) and custom regex commands (echo, ls, find, cd, jq, etc.) are auto-allowed when all path arguments resolve inside cwd or allowed directories. Internal tool auto-allow: Agent, Skill, and Glob now get explicit allow decisions (permissionDecision: allow) instead of passthrough, preventing CC's native confirmation dialogs. Overlay proposal anchoring: Bash proposals changed from ^<cmd>\s to ^<cmd>(\s[safe-chars]*)?$ using CC's safe character class to block compound operator injection in proposed rules. Additional allowed directories: new optional allowed_dirs field in passthru.json v2. Bootstrap imports additionalAllowedWorkingDirs from CC settings. Path validation for Read/Edit/Write/Grep auto-allow and readonly Bash commands checks cwd plus all allowed dirs.
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
splitCommand()approach. Deny on ANY segment, allow requires ALL segments covered.../), tilde expansion (~/,~user), and redirects (>,<).allowed_dirsin passthru.json schema. Bootstrap imports CC'sadditionalAllowedWorkingDirs.Test plan
cat src/file.txtauto-allows,cat /etc/passwddoes not