You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] shell blocklist rejects rm -rf under /tmp because it is a raw substring match #11039
astrbot_execute_shell rejects any command containing rm -rf, even when the only target is a temporary directory under /tmp. The current check is a raw substring match, so a benign cleanup command is treated the same as rm -rf /.
Environment
AstrBot 4.29.4 (also present on current master)
Debian 12 / aarch64 (Raspberry Pi)
provider_settings.computer_use_runtime = local
astrbot_execute_shell works for ordinary commands; only this pattern is blocked
Reproduction
Call the local shell tool with a command that only deletes a temp directory:
rm -rf /tmp/my_build && mkdir -p /tmp/my_build && cp -r ./src /tmp/my_build/ && cd /tmp/my_build && make
Legitimate temp-directory cleanup is blocked. Agents commonly react by reporting that their tools are incomplete or by refusing to continue, instead of using a workaround.
Suggested fix
Allow rm -rf / rm -fr / rm -r only when every target is a literal path under /tmp/ and contains no ..; keep blocking non-/tmp targets, variables, command substitution, and all other patterns (sudo, mkfs, dd, shutdown, killall, etc.). Alternatively, make the blocklist configurable instead of hardcoded.
Related
删除个目录 被阻止了 #8552 reports the same class of problem (closed without a code fix).
Activity
Ethereal49 commentedon Nov 8, 2026
我接手这条。当前
astrbot/core/computer/booters/local.py:48的拦截表里有" rm -rf "这类原始子串项,所以rm -rf /tmp/my_build ...会被当成rm -rf /一样拒绝。计划:把「绝对危险目标」和「普通路径」分开判断——只有目标包含根目录、家目录、系统目录或未限定的通配符时才拒绝;
/tmp等工作目录下的临时目录允许,其它路径保持原有拦截。单元测试覆盖:rm -rf /tmp/x通过、rm -rf /与rm -rf ~仍拒绝、带&&的复合命令按每个rm判断;不执行真实删除,只测判定函数。Ethereal49 commentedon Nov 9, 2026
/dev/fd/11