Harness Notes

Permissions

Updated 2026-11-25,

On this page

How to stop an agent doing something, and what each harness gives you to control it. Permission rules decide what the agent may do; a sandbox limits what a command can reach even when it is allowed.

Block a command, for example git push

Codex CLI
How

A command rule file

File.codex/rules/deny-push.rules
Example
prefix_rule(
    pattern = ["git", "push"],
    decision = "forbidden",
    justification = "Pushing is a human decision",
    match = ["git push", ["git", "push", "origin", "main"]],
)
How it matches

ordered argv-token prefix matching; .rules files are auto-discovered below the rules directory of each configuration layer

What wins

forbidden is stricter than prompt and allow and cannot be approved interactively

Watch out for

Command rules belong in .codex/rules/*.rules, not config.toml.

--ignore-rules skips user and project rule files; use a managed layer or OS containment when the invoking user must not be able to bypass the rule.

Wrappers and nested interpreters require separate coverage unless Codex's nested-command parser recognizes the invocation.

What you can control

Codex CLI
Decisions

allow, ask, deny

Permission rules

Built in

Cover: sandbox escalation, command rules, MCP elicitation, permission request, skill approval

Match by: approval_policy plus command rules

Docs
Sandbox

Built in

Limits: filesystem, network

Modes: read-only, workspace-write, danger-full-access

Enforced separately from permission rules.

Docs
Approval prompts

Built in

Modes: untrusted, on-request, never

approval_policy and sandbox_mode are separate inputs

0.163.0 release notes: saved-thread resume restores permissions and network approvals while respecting explicit overrides and current managed policy. The proxy checks permission before DNS lookup, rejects duplicate Host headers, and prevents credential aliases from bypassing inspection hooks.

MCP elicitation may be governed by approval policy, but its accept/decline/cancel plus structured content is a separate protocol from permission allow/ask/deny. In 0.163.0, eligible empty-confirmation auto-accept and post-startup Full Access form-input exceptions mean never does not imply every elicitation is declined. See docs/research/mcp-elicitation.md.

0.164.0 TUI accepts inline /permissions profile selection with optional approval-policy/reviewer arguments; profiles are discovered/validated before queued input continues.

0.164.0 source audit: approvals_reviewer = auto_review selects Guardian (user is the default; guardian_subagent is a legacy alias). Ordinary automatic routing requires on-request or granular approval policy; reviewer choice is separate from sandbox containment and approval categories.

The App Server registers the Guardian reviewer extension; core approval decisions consult registered contributors before synchronous fallback. Model/managed constraints can require review. Already-permitted actions and full-access fast paths may avoid review; auto_review does not mean every tool call is classified.

Guardian uses a separate read-only reviewer with no approval escalation. Prompt/model/parse failures deny or abort; default risk policy allows low/medium risk subject to explicit denies and injection checks, and permits high risk only with sufficient scoped authorization; critical risk is denied. Managed guardian_policy_config precedes local [auto_review].policy.

Transcript audit: parent GuardianAssessment/GuardianWarning events are non-durable. Non-ephemeral internal Guardian reviewer sessions can retain prompts and final JSON, but parallel/incompatible ephemeral forks do not. App Server item/autoApprovalReview/started and completed notifications carry review details separately; codex exec --json does not forward them as dedicated review events. See docs/research/automatic-approval.md.

0.166.0: resuming or forking a thread restores the approval and permission settings that the thread last accepted, rather than settings recorded by a turn that was still running at the time. Explicit sandbox or permission overrides on the resume or fork request still take precedence.

0.166.0 Linux sandbox: if Codex cannot inspect the search root of a deny-read glob (for example a symlink loop or permission error), the command now fails instead of silently dropping that deny rule. Missing or non-directory roots still just match nothing.

0.167.0 managed prompt-user checkpoint, traced at 0.167.2: requirements.toml prefix rules can require fresh human approval for every execution attempt. Hooks and automatic review cannot satisfy it; approval cache/rule amendments do not replace it. A never/rejecting approval policy or enforced automatic-only review rejects the command instead. This is a managed-rule decision, not a fourth approval_policy mode. No runtime probe.

In 0.172.0, apps.<app>.tools.<tool>.approvals_reviewer selects who reviews a connected app tool approval. Resolution checks tool, link, app, app defaults, then the session reviewer. Managed requirements constrain the selection and can require automatic review for the model.

In 0.172.0, local codex exec resume reads the permission profile and workspace roots from the resumed embedded App Server thread and uses its chosen working directory. Explicit resume overrides still apply.

Docs
Skills granting tools

Not supported

Codex does not interpret SKILL.md allowed-tools as a skill-scoped permission grant.

Docs
Hooks that decide

Built in

PreToolUse, PermissionRequest

Can: allow, deny

PreToolUse can only deny; PermissionRequest can allow or deny, and any deny wins.

Hook-definition trust and tool approval are separate controls.

Docs
Where rules live
  • ~/.codex/config.toml, user
  • .codex/config.toml, project
  • CLI flags and -c overrides, session

Priority between these files is not recorded here.

Sources

Codex CLI