# Codex enterprise governance: requirements.toml, access, and audit

URL: https://developertoolkit.ai/en/codex/team/enterprise-governance/
Description: Govern Codex across engineering teams: workspace access, enforced requirements.toml floors, MDM rollout, audit telemetry, and a CI hostile-config canary.

Codex enterprise governance combines ChatGPT workspace access controls with an administrator-owned `requirements.toml` that constrains sign-in, approval policies, sandbox modes, web search, MCP servers, plugin marketplaces, and forbidden commands on every managed machine. Platform teams and CTOs prove enforcement continuously with an automated hostile-config canary in CI rather than inspecting developer laptops.

When security reviews ask for proof that no engineering laptop runs Codex with unrestricted filesystem access, personal API keys, or unreviewed MCP servers, a wiki policy proves intent rather than control. You need machine-enforced floors, documented boundary gaps, and a CI check that fails before a weakened policy can ship. For a cross-agent policy rendered across Claude Code, Codex, and Cursor simultaneously, see [enforcing one policy across every coding agent](/en/org/managed-policy/).

## Separate defaults from non-overridable constraints

Codex keeps developer defaults (`config.toml`) strictly separate from administrator floors (`requirements.toml`) and workspace access rules:

| Layer | Location | Owner | Overridable by developer? | Primary role |
| --- | --- | --- | --- | --- |
| ChatGPT workspace settings | Workspace admin console | Workspace admins | No | Access eligibility (local and cloud), shared cloud environments, connectors |
| `requirements.toml` | `/etc/codex/requirements.toml` (Linux), macOS MDM preferences, or workspace-managed delivery | Security / platform team | No (disallowed values fall back to the first allowed item with a startup warning) | Hard floors: login, approvals, sandbox, web search, MCP, marketplaces, command rules |
| System `config.toml` | `/etc/codex/config.toml` | Platform team | Yes | Fleet defaults such as `[otel]` telemetry exporter |
| User and project `config.toml` | `~/.codex/config.toml` and trusted `.codex/config.toml` | Developers and teams | Yes | Personal and repository workflow preferences ([Codex configuration](/en/codex/quick-start/configuration/)) |

Two architectural boundaries matter upfront:

- **Enforced constraints vs fleet defaults:** Know which controls Codex enforces rigidly (login method, workspace ID, sandbox/approval ceilings, web search, MCP server identities, plugin marketplaces, command prefix rules, and optional provider/catalog pinning) versus which remain defaults developers can override (such as OpenTelemetry export, monitored by comparing active collector telemetry against workspace seats). Model routing governance across gateways is detailed in [lock-in and portability](/en/org/lock-in-and-portability/).
- **Local policy stops at the laptop:**

**requirements.toml does not govern Codex cloud**

`requirements.toml` constrains Codex wherever it executes locally—the CLI, IDE extension, and desktop app. Hosted cloud runs execute inside OpenAI-managed containers and must be governed separately through ChatGPT workspace access and each environment's internet and secret policies ([Codex cloud environments](/en/codex/automate/cloud-environments/)).

## Roll out Codex governance in six steps

Rollout order prevents the two worst failure modes: unenforced personal sign-ins and a broken syntax push that halts Codex fleet-wide.

1. **Write a risk-classified policy table before any TOML.** Map each control to its risk tier ([governance and autonomy](/en/org/governance-autonomy/)), exact enforcement mechanism, and named owner. Mark trust-based controls explicitly so auditors never confuse defaults with hard locks:

   | Control | Risk tier | Enforcement point | Owner |
   | --- | --- | --- | --- |
   | Workspace accounts only | High | `allowed_login_methods`, `allowed_chatgpt_workspaces` | Security |
   | No unrestricted disk access on laptops | High | `allowed_sandbox_modes` | Platform |
   | No unattended approvals by default | Medium | `allowed_approval_policies` | Platform |
   | Reviewed MCP servers only | High | `[mcp_servers.*.identity]` | Security |
   | Internal plugin marketplaces only | Medium | `[marketplaces]` | Platform |
   | Block force-push and package publish | High | `[rules] prefix_rules` | Platform |
   | Session telemetry exported to collector | Medium | System `config.toml` (default, monitored monthly) | Platform |

2. **Gate workspace access by pilot cohort.** Enable local and cloud Codex in the ChatGPT workspace admin console strictly for pilot groups first, widening rollout cohort by cohort.

3. **Pin authentication to your corporate workspace.** Set `allowed_login_methods = ["chatgpt"]` and `allowed_chatgpt_workspaces` so personal API keys cannot bypass workspace governance.

4. **Author versioned `requirements.toml` in a dedicated policy repository.** Record the policy version and owner on line 1, applying five schema invariants:
   - **List order sets the fallback:** When a developer asks for a forbidden value, Codex falls back to the **first** entry in `allowed_*`. Place your safest permitted option first (for example, `allowed_approval_policies = ["on-request"]` or `["on-request", "granular"]`; never list retired `untrusted`, which fails current Codex releases).
   - **Always include `read-only` in `allowed_sandbox_modes`:** Codex requires `read-only` as the safe fallback floor, and this list constrains both `sandbox_mode` and named permission profiles.
   - **Web search `disabled` stays allowed:** Setting `allowed_web_search_modes = ["cached"]` permits `cached` and `disabled` while blocking `live`.
   - **MCP servers match on exact name and identity:** Unlisted servers render as `disabled: requirements` in `codex mcp list`; publish canonical server names or pre-populate them in system `config.toml` ([MCP ecosystem](/en/ecosystem/mcp/)).
   - **Command rules only restrict (`prompt` or `forbidden`):** `decision = "allow"` is invalid and halts Codex startup completely. Reserve strict flags like `allow_managed_hooks_only` or data-residency pins for regulated device groups, noting that managed-hooks-only disables repository quality hooks unless migrated to managed hooks.

5. **Prove enforcement in CI before shipping.** Never push an untested `requirements.toml` to developer machines—one invalid entry breaks Codex startup everywhere.

6. **Distribute via MDM and track fleet drift weekly.** Push via Linux package/config management, macOS MDM managed preferences, or enterprise workspace delivery, then verify compliance with weekly `codex doctor --json` reports and file hashes.

For the exact current `requirements.toml` keys, MDM payload format, and workspace admin controls, consult the [official OpenAI Codex documentation](https://developers.openai.com/codex).

```toml
# /etc/codex/requirements.toml (conceptual baseline; confirm current schema in official docs)
allowed_login_methods = ["chatgpt"]
allowed_chatgpt_workspaces = ["CHATGPT_WORKSPACE_ID"]

# First entry is the automatic fallback when a user requests a disallowed setting.
allowed_approval_policies = ["on-request", "granular"]
allowed_sandbox_modes = ["read-only", "workspace-write"]
allowed_web_search_modes = ["cached"]

[mcp_servers.github.identity]
url = "https://api.githubcopilot.com/mcp/"

[rules]
prefix_rules = [
  { pattern = [{ token = "git" }, { token = "push" }, { token = "--force" }], decision = "forbidden", justification = "Force-push requires a human" },
  { pattern = [{ token = "npm" }, { token = "publish" }], decision = "forbidden", justification = "Releases publish only through CI" },
]
```

## Prove policy enforcement with a CI hostile-config canary

A policy is verified only when a deliberately hostile user configuration fails to bypass it. Run a credential-free canary job on every pull request in your policy repository:

1. **Create a hostile user fixture (`hostile-config.toml`)** requesting every forbidden value (`approval_policy = "never"`, `sandbox_mode = "danger-full-access"`, `web_search = "live"`, plus an unapproved MCP server).
2. **Run `codex doctor` and `codex mcp list` in a temporary `CODEX_HOME`** with the candidate `requirements.toml` installed at `/etc/codex/requirements.toml`. Fail the CI job if `requirements.toml` fails to load, if any constrained key passes without a requirement warning, or if the unapproved MCP server is not marked `disabled: requirements`.
3. **Protect the canary itself:** Place `.github/`, the canary script, and hostile fixtures under security `CODEOWNERS` with branch protection—otherwise a single pull request can weaken both the policy and the test together. Document controls not exercised by the automated canary (such as corporate workspace sign-in or forbidden command execution) in `GAPS.md` and validate them during pilot onboarding.
4. **Monitor fleet drift weekly:** Collect redacted `codex doctor --json` output alongside the SHA-256 hash of `/etc/codex/requirements.toml` through MDM. Never infer compliance from zero warnings, because a compliant user config produces zero warnings even when the policy file is missing.

Complement fleet-level policy with repository-level harness checks using `npx @wondelai/harness-audit` ([Harness Audit](/en/harness-audit/)).

## Map audit evidence to auditor questions

| Auditor question | Primary evidence source | Operational caveat |
| --- | --- | --- |
| What policy applied on machine X? | Versioned `requirements.toml` in Git + MDM hash + `codex doctor --json` | Reconcile hash weekly against deployed release tag |
| What actions did agent sessions run? | OpenTelemetry `[otel]` logs, traces, and metrics to your collector (`log_user_prompt` defaults `false`) | System default, not hard-locked; compare active senders to workspace seats monthly ([observability](/en/ecosystem/observability/)) |
| Who used Codex and at what volume? | Enterprise workspace analytics dashboard and Analytics API | Confirm exact available endpoints and retention terms in OpenAI Enterprise docs |
| What prompts/outputs occurred for eDiscovery or DLP? | OpenAI Enterprise Compliance API | Confirm plan eligibility and data retention settings with your account team ([agent threat model](/en/org/agent-threat-model/)) |

## When Codex enterprise governance breaks

- **Codex refuses to start fleet-wide after a policy rollout:** An invalid key or `decision = "allow"` rule broke `requirements.toml` parsing. Roll back immediately through MDM and require the CI canary to pass before any future push.
- **A constraint silently fails to trigger:** A misspelled top-level key may be skipped during load while the rest of the file succeeds. Only a hostile-config canary trying the forbidden value catches silent typos.
- **An approved MCP server shows `disabled: requirements`:** The developer registered it under a different table name than `requirements.toml` specifies. Publish exact canonical names or ship approved server entries in system `config.toml`.
- **Regulated policy breaks team quality hooks:** `allow_managed_hooks_only = true` suppresses repository hooks alongside untrusted ones. Migrate essential team hooks into managed hooks or scope the flag strictly to regulated device groups.
- **Telemetry drops silently for specific engineers:** Users can override system `[otel]` defaults locally. Reconcile collector coverage against active workspace seats monthly and follow up directly.
- **Cloud tasks bypass laptop restrictions:** Local `requirements.toml` never reaches hosted containers. Enforce matching network and secret controls in workspace and cloud environment settings.

## Official docs and next steps

Check [developers.openai.com/codex](https://developers.openai.com/codex) for current `requirements.toml` keys, MDM deployment guides, and Enterprise API documentation.

- Unified multi-agent controls: [enforcing one policy across every coding agent](/en/org/managed-policy/) · [governance and autonomy](/en/org/governance-autonomy/)
- Secrets, identity, and tool gateways: [agent identity and secrets](/en/org/agent-identity-and-secrets/) · [MCP registries and gateways](/en/ecosystem/mcp/)
- Telemetry and operations: [agent observability](/en/ecosystem/observability/) · [operating agents in production](/en/workflows/operate/)
- Need help designing a rollout across multiple teams? Explore our [advisory services](/en/services/)
