oudecheng
f37a5ffe6e
fix(platform): 收紧 safety guard 的 format 正则并按平台分组
原 \bformat\s+ 正则精度不足,会误伤 dart format、buf format、
pytest --format 等合法命令;Remove-Item 大写正则经 to_lowercase
后永远匹配不到,是潜在 bug。
改动:
- format 正则收紧为 \bformat\s+.*[a-z]:,要求出现盘符才拦截
- 按 Platform 分组注入规则,Unix 不再注入 Windows 专用规则
- Remove-Item 正则改为小写,与 guard_command 的大小写处理一致
- 平台相关测试加 #[cfg] 属性,避免跨平台失败
- 新增 test_format_pattern_precision 覆盖危险命令与误伤场景
- 新增 test_legitimate_format_commands_not_blocked 回归测试
验证:
- cargo test --lib platform:: 11/11 通过
- cargo test --lib tools::bash 13/13 通过
2026-08-03 22:45:36 +08:00
..
2026-08-03 14:21:01 +08:00
2026-07-15 16:36:13 +08:00
2026-07-03 19:32:14 +08:00
2026-08-03 14:46:49 +08:00
2026-06-14 10:24:52 +08:00
2026-08-03 22:10:25 +08:00
2026-08-03 14:46:49 +08:00
2026-07-30 17:37:29 +08:00
2026-07-30 22:44:10 +08:00
2026-08-03 22:10:25 +08:00
2026-07-08 15:52:36 +08:00
2026-05-12 17:44:39 +08:00
2026-08-03 22:45:36 +08:00
2026-08-03 22:10:25 +08:00
2026-08-03 14:26:20 +08:00
2026-06-02 23:31:05 +08:00
2026-08-03 14:26:20 +08:00
2026-08-03 22:15:13 +08:00
2026-08-03 22:45:36 +08:00
2026-06-02 15:23:50 +08:00
2026-07-21 16:33:55 +08:00
2026-07-21 16:33:55 +08:00
2026-06-19 10:40:00 +08:00
2026-06-19 10:40:00 +08:00
2026-04-28 10:33:31 +08:00
2026-06-10 11:26:35 +08:00