codex icon indicating copy to clipboard operation
codex copied to clipboard

Allow on Windows for powershell read commands whilst still restricting editing

Open robertmylne opened this issue 1 year ago • 8 comments

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

robertmylne avatar Sep 16 '25 03:09 robertmylne

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

LaelLuo avatar Sep 16 '25 20:09 LaelLuo

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.

Tlinov avatar Sep 16 '25 20:09 Tlinov

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

InsightfulFuture avatar Sep 16 '25 20:09 InsightfulFuture

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

Yes

Tlinov avatar Sep 16 '25 20:09 Tlinov

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

InsightfulFuture avatar Sep 16 '25 21:09 InsightfulFuture

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

Tlinov avatar Sep 16 '25 21:09 Tlinov

@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.

LaelLuo avatar Sep 17 '25 13:09 LaelLuo

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

etraut-openai avatar Jan 24 '26 07:01 etraut-openai