mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
dde615f482
Implement command safety for PowerShell commands on Windows This change adds a new Windows-specific command-safety module under `codex-rs/core/src/command_safety/windows_safe_commands.rs` to strictly sanitise PowerShell invocations. Key points: - Introduce `is_safe_command_windows()` to only allow explicitly read-only PowerShell calls. - Parse and split PowerShell invocations (including inline `-Command` scripts and pipelines). - Block unsafe switches (`-File`, `-EncodedCommand`, `-ExecutionPolicy`, unknown flags, call operators, redirections, separators). - Whitelist only read-only cmdlets (`Get-ChildItem`, `Get-Content`, `Select-Object`, etc.), safe Git subcommands (`status`, `log`, `show`, `diff`, `cat-file`), and ripgrep without unsafe options. - Add comprehensive unit tests covering allowed and rejected command patterns (nested calls, side effects, chaining, redirections). This ensures Codex on Windows can safely execute discover-only PowerShell workflows without risking destructive operations.
dde615f482
ยท
2025-10-01 09:56:48 -07:00
History