Whitelisted commands lose sandbox bypass in compound commands

Open Beginner friendly
#37,405 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Quiet
Tech stack
rust
Domain
documentation

Research direction

Read the command-segmentation guidance in codex-rs/prompts/templates/permissions/approval_policy/on_request.md and codex-rs/prompts/templates/permissions/approval_policy/on_request_rule_request_permission.md. Add the proposed clarification after that guidance in both files, then verify that each explains sandbox bypass requires an explicit allow match for every shell segment and recommends running whitelisted commands standalone.

Written by the indexing model from the issue text.

Description

CLI documentation sandbox

Problem

With ["gh", "auth", "status"] in Approved command prefixes, standalone gh auth status bypasses the sandbox. The github:yeet workflow may nevertheless batch it with repository checks before publishing:

git status -sb && git diff && gh auth status

The standalone gh auth status allow rule does not bypass the sandbox because the preceding git segments have no explicit allow rule. The whole invocation stays sandboxed, so gh may be unable to access the host keyring and incorrectly report an invalid token.

Root cause

codex-rs/core/src/exec_policy.rs only bypasses the sandbox when every parsed shell segment has an explicit allow match. The model-facing instructions say segments are evaluated independently, but omit that condition.

Proposed clarification

Add this after the command-segmentation guidance in:

  • codex-rs/prompts/templates/permissions/approval_policy/on_request.md
  • codex-rs/prompts/templates/permissions/approval_policy/on_request_rule_request_permission.md

Exec-policy allows sandbox bypass only when every shell segment has an explicit allow match. Run whitelisted commands standalone.

This preserves the security model while preventing an avoidable failure in a common GitHub publishing workflow.

Dominant language
Rust
Stars
125k
Forks
19.5k
Avg merge
1m
Merged PRs (30d)
1k

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.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.