Allow on Windows for powershell read commands whilst still restricting editing

Resolved 💬 8 comments Opened Sep 16, 2025 by robertmylne Closed Jan 24, 2026
💡 Likely answer: A maintainer (LaelLuo, contributor) responded on this thread — see the highlighted reply below.

What feature would you like to see?

I don't want to allow codex to edit without approval. However, by doing this I also have to approve all reads. Which might require 20 approvals per request. Can we not just allow all reading commands whether with powershell or not.

Are you interested in implementing this feature?

_No response_

Additional information

_No response_

View original on GitHub ↗

8 Comments

LaelLuo contributor · 10 months ago

My solution is to add a prompt to prohibit the use of pwsh package command execution in AGENTS.md

AmirTlinov · 10 months ago

Codex CLI config example (2025-09-16)

language = "en"

Only "trusted" read commands (ls, cat, sed, etc.) run without confirmation.

approval_policy = "untrusted"

Keep sandboxing sane while still allowing local edits in the workspace.

sandbox_mode = "workspace-write"
use_plans_for_multistep = true
[tools]
web_search = false

With this setup, you can permit read-only PowerShell commands while still restricting editing or potentially destructive actions—very similar to how it works in Claude Code.

InsightfulFuture · 10 months ago

@iMAGRAY Does the above solution apply to the IDE extension as well?

AmirTlinov · 10 months ago
@iMAGRAY Does the above solution apply to the IDE extension as well?

Yes

InsightfulFuture · 10 months ago

Does this also apply to the powershell commands like Get-Content? The agent was choosing to use those instead of the unix-like aliases like cat

AmirTlinov · 10 months ago
Does this also apply to the powershell commands like Get-Content? The agent was choosing to use those instead of the unix-like aliases like cat

Not sure. This needs to be checked. But the configuration is quite flexible

LaelLuo contributor · 10 months ago

@iMAGRAY The configuration example you provided contains invalid options that don't exist in Codex:

  • language = "en" - This configuration field doesn't exist in Codex
  • use_plans_for_multistep = true - This configuration field doesn't exist in Codex

The correct configuration for allowing read-only PowerShell commands while restricting editing would be:

approval_policy = "untrusted"
sandbox_mode = "workspace-write"

You can verify the actual supported configuration options in the Codex configuration documentation or by checking the configuration struct in the source code.

etraut-openai contributor · 5 months ago

This should be working with recent versions of Codex. If you're seeing problems, please open a bug report.