mirror of
https://github.com/shareAI-lab/analysis_claude_code.git
synced 2026-09-20 12:13:38 +08:00
fix: harden destructive command matching
This commit is contained in:
@@ -98,11 +98,38 @@ COMMAND_CASES = (
|
||||
("echo ready & rm file.txt", True),
|
||||
("(del file.txt)", True),
|
||||
("rm; echo ready", True),
|
||||
("if exist test.txt del test.txt", True),
|
||||
("if not exist other.txt DEL test.txt", True),
|
||||
("cmd /c del test.txt", True),
|
||||
('cmd /c "if exist test.txt del test.txt"', True),
|
||||
('for %F in (test.txt) do del "%F"', True),
|
||||
("@DEL test.txt", True),
|
||||
("call del test.txt", True),
|
||||
("command rm test.txt", True),
|
||||
("env FLAG=1 rm test.txt", True),
|
||||
("sh -c 'rm test.txt'", True),
|
||||
("bash -lc 'rm test.txt'", True),
|
||||
("{ rm test.txt; }", True),
|
||||
("/usr/bin/rm test.txt", True),
|
||||
("del/q test.txt", True),
|
||||
("echo $(rm test.txt)", True),
|
||||
('echo "$(rm test.txt)"', True),
|
||||
("echo `rm test.txt`", True),
|
||||
("cat <(rm test.txt)", True),
|
||||
("then " * 20 + "echo safe", True),
|
||||
("echo 'unterminated", True),
|
||||
("model list", False),
|
||||
("delimiter file.txt", False),
|
||||
("echo del file.txt", False),
|
||||
("echo; delimiter file.txt", False),
|
||||
("not-rm file.txt", False),
|
||||
('echo "safe; del test.txt"', False),
|
||||
("echo 'safe (rm test.txt)'", False),
|
||||
('echo ";" del test.txt', False),
|
||||
('if "del"=="safe" echo okay', False),
|
||||
('printf "rm test.txt\\n"', False),
|
||||
("command -v rm", False),
|
||||
("echo '$(rm test.txt)'", False),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user