Commit cd367ee
committed
Reject shell metacharacters in cancel allowlist exception
The methodology-phase cancel exception returned early for any command
beginning with cancel-rlcr-loop.sh that did not contain `;`, `|`, or `&`.
Payloads such as
cancel-rlcr-loop.sh $(touch /tmp/pwn)
cancel-rlcr-loop.sh \`touch /tmp/pwn\`
cancel-rlcr-loop.sh > /tmp/pwn
cancel-rlcr-loop.sh\nrm -rf /
still satisfied the narrow metachar check and short-circuited past the
downstream file-mod, redirection, and interpreter blockers, effectively
letting arbitrary write operations ride alongside the cancel
invocation.
Extend the reject list to include command substitution opener `$(`,
backticks, redirection (`<`, `>`), and embedded newlines, and switch
from `echo | grep` to a bash case expression so a newline inside the
command text does not bypass the single-line grep semantics. Preserve
`${CLAUDE_PLUGIN_ROOT}` variable expansion (which does not use `$(`) so
the slash-command cancel path continues to work.1 parent 0ca864d commit cd367ee
1 file changed
Lines changed: 17 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
91 | 104 | | |
92 | 105 | | |
93 | 106 | | |
| |||
0 commit comments