nanocoder
nanocoder copied to clipboard
[Bug] The execute_bash safety validator misses common spellings of "rm -rf /"
Summary
The destructive-command check only matches the exact text rm -rf /. Other spellings of the same command pass the validator.
Steps to reproduce
Run executeBashTool.validator({command}) for each command below.
Expected behaviour
All variants of "recursive force delete of /" are blocked.
Actual behaviour
rm -rf / blocked
rm -fr / ALLOWED
rm -r -f / ALLOWED
rm -rf --no-preserve-root / ALLOWED
rm -rf ~ ALLOWED
A spec fails on the first allowed command: rm -fr / Value is not false: true. Outside yolo and headless mode bash still asks for approval, so this matters most when approval is off.
Environment
Windows 11, Node v22.22.3, Nanocoder 1.31.0 (main at 948a4e74)
Suggested fix
source/tools/execute-bash.tsx:232: parse the flags (any order,-rand-ftogether or apart,-R,--recursive,--force) and the target (/,/*,~,$HOME), instead of one regex.- Or document the list as best-effort and stop saying matches are "blocked for safety".
hey @addyCooks i would be happy to pick this up