This release closes several ways a dangerous command could reach the shell unchecked: commands sent by Amp bypassing the secret, policy and Git-metadata guards, shell options that look like a syntax check but still execute, ambiguous -c option clusters, and Git discard relaxations in repositories that can redirect Git elsewhere. Commands containing a carriage return or an unquoted Unicode blank are now refused as unparseable.
Highlights
- Fixed a bypass in Amp, whose Bash tool sends the command outside
input.command:cat .env,cat ~/.ssh/id_rsa, a redirect into the user policy file and a write under.git/hookswere allowed at every safety level. The secret, policy-config, policy-apply and Git-metadata guards now read the command that will actually run. (#264) - Improved the shell syntax-check exemption, which allowed invocations that still execute their
-cbody, such aszsh -n -o exec -c '<cmd>',bash -nc +n '<cmd>'andksh -n --exec -c '<cmd>'. The exemption now holds only when every option word is-nor-c; anything else is analyzed normally. (#267)
Changed
- Changed
autoshell mode to evaluate both readings of a command that it guesses is PowerShell: the command is denied when either the PowerShell or the POSIX reading denies. (#265) - Changed
cc-safety-net explainto report the trace of the shell reading that produced the decision instead of mixing both readings. (#265) - Changed Git discard relaxations for disposable temporary repositories and linked worktrees to be withheld when the repository can send Git elsewhere — a
core.worktreesetting in the command, the shared config orconfig.worktree, a symlink or FIFO inside the Git directory, or aHEADin an ancestor directory. Force-clean and discard commands in such a repository are blocked at standard and strict safety. (#269) - Changed command parsing to refuse a carriage return, vertical tab or form feed anywhere in a POSIX-parsed command, at every safety level. Heredoc bodies with CRLF line endings that were previously allowed are now blocked. (#268)
Fixed
- Fixed shell argv whose
-ccluster hides the real command string being allowed —bash -c -x '<cmd>',sh -c - '<cmd>',dash -oc pipefail '<cmd>',ksh -oc '<cmd>',zsh -ocorrect -c '<cmd>'and any argv containing a+option word. These are now refused because the command string cannot be identified, including throughxargs,parallel,find -execand heredocs. Real syntax checks such asbash -n script.shandbash -n -c '<cmd>', andbash -o pipefail -c 'echo ok', stay allowed. (#267) - Fixed unquoted Unicode blanks being treated as word separators when bash and zsh keep them inside a word, so a command such as
rm<NBSP>-rf /tmp/xwas analyzed differently from how the shell runs it. Non-breaking space, U+3000, U+2000–U+200A, U+202F, U+205F, the byte order mark and others are now refused; a blank inside quotes or a heredoc body is still allowed, so quoted non-ASCII text such as a commit message is unaffected. (#268)