2.3 KiB
Bash deny-rule evasion probe (2026-10-25)
Question: do permissions.deny Bash rules survive shell wrappers, or must every
rule be duplicated for bash -c, cd &&, heredocs…? Method: claude -p --model haiku --tools Bash, one harmless analogue rule Bash(echo SECRET*), every
variant sent verbatim, the tool_result read for "has been denied"; each run
repeated without the rule to separate DENY-RULE from ASK. run.sh <label> <cmdfile> [settings]. Raw rows in results.tsv.
Facts
Matcher sees through (no duplication needed): a && b, a; b, a || b,
a | b, newline, ( … ), env, command, \cmd, timeout, nohup,
xargs, "echo", ec""ho, double spaces, simple assignments (x=echo; $x,
S=SECRET; echo $S).
Matcher does NOT see through: bash -c (in ask already), sh -c (no rule),
eval (asks natively), bash <<EOF (seen as bare bash), $(…) in command
position, absolute path /bin/echo, interpreters (python3 -c, awk system(), node -e), a quoted literal argument (echo "SECRET" escapes
SECRET*; so git push origin ":feature" escapes :**).
defaultMode auto: every miss above was approved by the classifier in -p,
not prompted. The classifier is the only backstop.
rtk-rewrite hook runs BEFORE permission evaluation; the deny is evaluated on
the REWRITTEN command. cat SECRET.txt under deny Bash(cat SECRET*): DENIED
with hooks off, RAN with the user hooks on (output hello via rtk read).
rtk rewrite "git push origin :feature" → rc=3 → rtk git push origin :feature: deny git push * :*/:** and ask git push * no longer match
(hotfix ac23cc6 bypassed in real use). rtk rc=2 forms (--delete, +ref,
--force*, .env, id_rsa, .aws, find -delete/-exec, git branch -D)
are left unchanged, native deny holds. rc=0 misses: cat */*.pem,
cat */secrets/* (rewritten to rtk read).
Redirections: echo > f, tee f, cat > f <<EOF into a path denied for
Edit are DENIED. Good.
Precedence: ask beats allow (ask Bash(bash *) + allow Bash(bash */.claude/lib/*) still prompts). Exact Bash(bash) catches the heredoc form
and leaves bash script.sh alone. Patterns proven to match: Bash(/*),
Bash(awk *system*), Bash(sh -c *), Bash(python3 -c *), Bash(node -e *),
Bash(bash -s*), Bash(bash <(*), Bash(bash */.claude/lib/*) (tilde form).