Commit 0fe60ee
committed
feat(security): bash command security + auto-allow hardening
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.1 parent eaddf65 commit 0fe60ee
12 files changed
Lines changed: 2905 additions & 79 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
56 | 74 | | |
57 | 75 | | |
58 | 76 | | |
| |||
0 commit comments