Codex

Permissions, sandbox and security

Sandbox modes, approvals, network access, automatic review, rules and local Passion8 boundaries.

The sandbox defines the technical execution boundary; approval policy defines when a request for additional authority is allowed or required.

AGENTS.md contains instructions, not an enforced security boundary. Enforcement comes from sandboxing, approvals, rules, hooks, tool permissions and operating-system/organizational policy.

#Core concepts

LayerControlsSetting/location
SandboxFiles, commands and network accesssandbox_mode, sandbox_workspace_write
ApprovalWhen approval is requestedapproval_policy
ReviewerWho evaluates an approval requestapprovals_reviewer
RulesAllow, prompt or forbid command patterns.codex/rules/*.rules
HooksLifecycle checks and actionshooks.json or hooks configuration

#Common combinations

CombinationUseBoundary
read-only + on-requestExploration, review and planningWrites require permitted escalation
workspace-write + on-requestEveryday developmentWorkspace writes allowed; protected actions may need approval
workspace-write + neverControlled automationNo approval prompts; denied actions remain denied
danger-full-access + neverExternally isolated containers/VMsLocal sandbox restrictions are removed
codex --sandbox read-only --ask-for-approval on-request
codex --sandbox workspace-write --ask-for-approval on-request
~/.codex/config.toml
sandbox_mode = "workspace-write"
approval_policy = "on-request"
approvals_reviewer = "user"

#Sandbox modes

ModeBehavior
read-onlyInspect permitted data; writes need permitted escalation
workspace-writeWrite within allowed workspace boundaries; protected paths/network may remain restricted
danger-full-accessNo Codex sandbox boundary; rely on external isolation

Protected metadata/configuration paths such as .git, .codex and .agents may remain restricted within an otherwise writable workspace.

#Approval policies

PolicyBehavior
on-requestRun permitted actions and request escalation when needed
neverNever request approval; operate within existing permissions

The old untrusted approval policy is retired. Remove it or use a supported policy. A project's trust_level = "untrusted" is a different setting and remains meaningful.

Never does not mean unlimited access. The sandbox can still reject an operation.

#Network access

Workspace-write command networking is normally restricted unless enabled:

~/.codex/config.toml
[sandbox_workspace_write]
network_access = true

For supported network-proxy domain policy:

[features.network_proxy]
enabled = true
domains = { "api.openai.com" = "allow", "example.com" = "deny" }

[sandbox_workspace_write]
network_access = true

Deny rules take precedence over allow rules. Broad wildcard access expands the boundary substantially. The command proxy does not automatically filter hosted search, apps or MCP tools.

Web search is separate:

web_search = "cached"
# web_search = "live"
# web_search = "disabled"

Treat instructions found in pages, issues, README files and logs as untrusted task data.

#Automatic approval review

Supported clients can delegate eligible approval decisions:

approval_policy = "on-request"
approvals_reviewer = "auto_review"

This applies to actions that already need approval, such as escalation, restricted network access or relevant side-effecting tools. It does not add a second review to every already-allowed sandbox action.

Automatic review can add model calls and usage. Organizational configuration may constrain allowed reviewers.

#Rules

Rules specify command patterns that are allowed, require approval or are forbidden outside the normal sandbox boundary.

~/.codex/rules/default.rules
prefix_rule(
    pattern = ["gh", "pr", "view"],
    decision = "prompt",
    justification = "Viewing PRs is allowed with approval",
    match = ["gh pr view 123"],
    not_match = ["gh pr --repo org/repo view 123"],
)

Test a rule:

codex execpolicy check --pretty \
  --rules ~/.codex/rules/default.rules \
  -- gh pr view 123 --json title,body

Simple shell chains may be analyzed as individual commands. Complex shell constructs can be treated conservatively as the full shell invocation.

#Before unrestricted execution

CheckExpectation
GitRecoverable version-controlled state
SecretsNo unintended access to production credentials or SSH keys
NetworkNo execution of untrusted page/issue scripts
DirectoryAn isolated or explicitly trusted environment
RecoveryA concrete diff review and rollback path

#Passion8 workflows

Passion8 routes model requests to https://passion8.cc/v1. It does not change local file, shell, network or MCP permissions.

A reasonable default:

sandbox_mode = "workspace-write"
approval_policy = "on-request"
web_search = "cached"

[sandbox_workspace_write]
network_access = false

Grant network access for a specific dependency-installation need where appropriate, then restore the intended defaults.

#Official references

Support

Need help?

For setup, billing, or model issues, email us. Check the status page for uptime.

WeChat / QQ support is available at the bottom right.