openai / openai/codex

VS Code extension ignores project-scoped approval_policy = "never" for sandbox escalation requests

Open
#37,914 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug config extension sandbox
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

What version of the IDE extension are you using?

26.803.61601

What subscription do you have?

ChatGPT Plus

Which IDE are you using?

VS Code

What platform is your computer?

Linux 6.18.33.2-microsoft-standard-WSL2 x86_64 unknown

What issue are you seeing?

The Codex VS Code extension appears to ignore a project-scoped
approval_policy = "never" setting when an operation requires crossing the
sandbox boundary.

In this reproduction, writing to the protected .git directory is used only
as a convenient way to trigger a sandbox escalation request. The issue may
affect other operations that require elevated permissions as well.

Despite the active project-scoped approval policy, Codex generates an
escalation request. Depending on the user's approval configuration, this
request may be shown as an approval prompt or handled by an automatic reviewer.

With approval_policy = "never", Codex should not generate the escalation
request. The operation should remain within the sandbox and fail.

What steps can reproduce the bug?
  1. Create a project containing the following .codex/config.toml:

    approval_policy = "never"
    
  2. Mark the project as trusted in $CODEX_HOME/config.toml:

    [projects."/absolute/path/to/repro-vscode-approval-policy"]
    trust_level = "trusted"
    
  3. Open the trusted project in VS Code.

  4. Start a new Codex conversation so that the project-scoped configuration is loaded.

  5. Ask Codex to run:

    touch .git/codex-write-probe
    
  6. Observe that Codex requests elevated permissions despite
    approval_policy = "never".

    Depending on the active approval setup, the request may appear as a manual
    approval prompt or be handled automatically.

What is the expected behavior?

With the following project-scoped configuration:

approval_policy = "never"

Codex should not generate an escalation request for the command.

Because .git is a protected path, the command should remain within the active
sandbox and fail with a permission error. No manual approval prompt or
automatic review should occur, and .git/codex-write-probe should not be
created.

Additional information

Writing to .git is only the probe used by this reproduction. This report does
not assume that the issue is limited to .git; other operations that cross the
sandbox boundary may be affected.

This issue may have broader security implications beyond this specific
reproduction.

OpenAI's Daybreak security guidance strongly encourages users to avoid full
access, keep agents within their intended security boundaries, and regularly
test sandbox boundaries:

https://openai.com/index/expanding-daybreak-as-the-cyber-defense-window-narrows/

A project-scoped approval_policy = "never" is an explicit boundary selected
by the user. If the VS Code extension generates escalation requests despite
that policy, the effective behavior no longer matches the configured security
posture.

Because predictable enforcement of configured approval boundaries is important
to the security posture described in the guidance above, I believe this issue
warrants early investigation and remediation.

I do not currently believe this report demonstrates a directly exploitable
security vulnerability. The reproduction does not show a bypass of the
OS-enforced sandbox or approval mechanism. It shows that the VS Code extension
generates an escalation request despite the configured
approval_policy = "never". Depending on the user's approval setup, that
request may still require explicit approval or may be evaluated by an automatic
reviewer. I am therefore reporting this as a configuration and policy
enforcement bug.

That said, the mismatch between a configured security boundary and its
effective behavior has a security smell and may warrant deeper investigation.
As an IT engineer in Japan, I am not eligible to participate in the OpenAI
Bugcrowd program, so I do not have an appropriate channel through which to
report any security-sensitive findings that such an investigation might
uncover. For that reason, I have limited this report to the behavior necessary
to reproduce this bug and have not investigated it further.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior in VS Code with the project-scoped .codex/config.toml and trusted-project configuration described above. Trace how approval_policy = "never" is loaded and applied to sandbox escalation requests; done means the touch command fails inside the sandbox without an approval prompt or automatic review and does not create .git/codex-write-probe.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
security, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.