The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tools): anchor the mkfs hardline pattern to command position
liuhao10248163c8731b47
diff --git a/tests/tools/test_hardline_blocklist.py b/tests/tools/test_hardline_blocklist.pyindex 40b1c567555..7f0c392cf99 100644--- a/tests/tools/test_hardline_blocklist.py+++ b/tests/tools/test_hardline_blocklist.py@@ -82,6 +82,10 @@ _HARDLINE_BLOCK = ["mkfs.ext4 /dev/sda1","mkfs /dev/sdb","mkfs.xfs /dev/nvme0n1",+ # Command position via separator/wrapper still blocks (#93392)+ "true && mkfs.ext4 /dev/sda1",+ "sudo mkfs.ext4 /dev/sda1",+ "nohup mkfs /dev/sdb",# Raw block device overwrites"dd if=/dev/zero of=/dev/sda bs=1M","dd if=/dev/urandom of=/dev/nvme0n1",@@ -183,6 +187,10 @@ _HARDLINE_ALLOW = ["echo 'halt and catch fire'","python3 -c 'print(\"shutdown\")'","find . -name '*reboot*'",+ # Quoted prose mentioning mkfs must not trip the hardline floor (#93392):+ # the word appears in an argument, not at a command position.+ 'echo "does this workflow use mkfs anywhere?"',+ "echo 'run mkfs.ext4 on the backup disk later'",# Word-boundary protection"mkfs_helper --version",# systemctl non-destructive verbsdiff --git a/tools/approval.py b/tools/approval.pyindex c360ef204ec..b8b44e72933 100644--- a/tools/approval.py+++ b/tools/approval.py@@ -532,8 +532,10 @@ HARDLINE_PATTERNS = [(_RM_FLAG_PREFIX + _hardline_rm_path(r'/(?:(?:\.\.?)?/)*(?:\.\.?)?\**|/ \*'), "recursive delete of root filesystem"),(_RM_FLAG_PREFIX + _hardline_rm_path(_HARDLINE_SYSTEM_DIRS), "recursive delete of system directory"),(_RM_FLAG_PREFIX + _hardline_rm_path(r'(?:~|\$\{?HOME\}?)(?:/?|/\*)?'), "recursive delete of home directory"),- # Filesystem format- (r'\bmkfs(\.[a-z0-9]+)?\b', "format filesystem (mkfs)"),+ # Filesystem format — anchor to command position like every other+ # hardline entry so quoted prose ("echo \"does this workflow use mkfs+ # anywhere?\"") does not trip the unconditional floor (#93392).+ (_CMDPOS + r'mkfs(\.[a-z0-9]+)?\b', "format filesystem (mkfs)"),# Raw block device overwrites (dd + redirection)(r'\bdd\b[^\n]*\bof=/dev/(sd|nvme|hd|mmcblk|vd|xvd)[a-z0-9]*', "dd to raw block device"),(r'>\s*/dev/(sd|nvme|hd|mmcblk|vd|xvd)[a-z0-9]*\b', "redirect to raw block device"),