Repository navigation
fix(guard): catch rm -rf / and crontab - where they end inside JSON - #151
Merged
Merged
Conversation
The wall matches a tool call's arguments as JSON text. A command there
ends at a closing quote, `{"command":"rm -rf /"}`, but rm-rf-root and
crontab-install anchored the end of the command on whitespace or end
of input, so the most common form of both calls went unseen — on the
desktop as well as in the server edition, where a new test caught it.
Both now also accept a quote, `;`, `&`, `|` or `)` after the command.
A path under home or root (`rm -rf /tmp/build`) and `crontab -l` still
do not match.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
The wall matches a tool call's arguments as JSON text, where a command ends at a closing quote:
{"command":"rm -rf /"}.rm-rf-rootandcrontab-installanchored the end of the command on whitespace or end of input, so the most common form of both calls went unseen. This affected the desktop too. A new server-edition unit test caught it.Both rules now also accept a quote,
;,&,|or)after the command.A new test covers the JSON forms:
rm -rf /,rm -rf ~,rm -rf $HOME && …,rm -rf /;ls,… | crontab -.rm -rf /tmp/build,rm -rf ~/project/node_modules,crontab -l.cargo test --workspaceand clippy pass.🤖 Generated with Claude Code