mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-13 11:13:43 +08:00
fix(guard): detect find -delete as dangerous shell command
This commit is contained in:
parent
281b1efffd
commit
f08581daa7
@ -193,6 +193,13 @@ public class ShellCommandGuardian implements ToolGuardGuardian {
|
||||
"检测到 rm 删除操作,可能导致文件永久丢失",
|
||||
"请确认要删除的文件列表,考虑使用 trash 替代 rm"));
|
||||
|
||||
list.add(new ShellRule("SHELL_FIND_DELETE",
|
||||
"find\\s.*\\s-delete\\b",
|
||||
GuardSeverity.HIGH, GuardCategory.COMMAND_INJECTION,
|
||||
"find -delete 删除命令",
|
||||
"检测到 find -delete 操作,可能导致文件永久丢失",
|
||||
"请确认要删除的文件列表,考虑使用 trash 替代 -delete"));
|
||||
|
||||
list.add(new ShellRule("SHELL_RM_RF",
|
||||
"rm\\s+-(rf|fr)",
|
||||
GuardSeverity.HIGH, GuardCategory.COMMAND_INJECTION,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user