OpenAI coding agent

How to block or disable OpenAI Codex CLI

Codex runs commands, edits code and can connect to MCP servers from a developer's terminal, editor or desktop app. Block it where it is not approved, and where it is, enforce the sandbox and approval rules so nobody can switch them off.

Where Codex runs

Codex CLI in the terminal
Codex extension in VS Code and similar editors
The Codex desktop app
Codex cloud tasks connected to repositories

Next step

AI Agent Blocklist: Codex and every other coding agent, as package names, process names, app IDs and domains

Files for Intune, Jamf, VS Code policies, firewalls and DNS filters, with a risk grade on each entry and daily updates.

From $99 a month for one organisation See plans Ask a question

What Codex is, and what it is not

Codex is OpenAI's coding agent. The name covers several products that share one engine, which is why "block Codex" can mean four different jobs.

Codex CLI

A command-line agent that reads the repository, runs shell commands and edits files on the developer's machine.

IDE extension

The same agent inside VS Code and compatible editors. In VS Code its extension ID is openai.chatgpt.

Codex app

A desktop app that runs agent sessions, with optional browser and computer use features.

Codex cloud

Tasks that run in OpenAI's cloud against a connected repository and come back as changes to review.

OpenAI productWhere it runsWhat it controlsMain control for IT
Codex CLI, IDE extension and appOn the developer's computerFiles, shell, local network, MCP serversDevice rules and requirements.toml
Codex cloudOpenAI's cloud, connected to your repositoriesCode and branches in connected repositoriesChatGPT workspace settings and repository access
ChatGPT agentA browser and computer environment OpenAI runsWebsites, forms and connected accountsChatGPT workspace settings, see agent mode security
ChatGPT AtlasA browser installed on the user's computerThe user's own signed-in browsingApp and domain blocking, see block ChatGPT Atlas

OpenAI's earlier Operator preview was folded into ChatGPT agent in 2025. Comparisons such as "Operator vs Codex" or "ChatGPT agent vs Codex" come down to one split: agents that browse for you, and an agent that changes code.

There is no Codex Chrome extension. See the ChatGPT Chrome extension page for the browser side.

Signs Codex is already on your devices

Check these before you change any policy. They tell you who uses Codex, which surface they use, and whether personal accounts are involved.

Processes

A codex process in endpoint telemetry, often started from a terminal, an editor or the Codex app.

Config folders

A .codex folder with config.toml in user home directories, and AGENTS.md files in repositories.

Editor inventory

The Codex extension in VS Code or a compatible editor across your developer fleet.

Traffic

Developer machines reaching OpenAI and ChatGPT domains outside the hours or teams you expect.

The settings that decide how much Codex can do

Codex has two guard rails on a local machine: a sandbox that limits what commands can touch, and approvals that ask the user before stepping outside it. Users can loosen both unless you enforce them.

read-only

Narrow

Codex can read files and answer questions but does not change them. The default in folders that are not under version control.

workspace-write

Default

Codex can edit inside the workspace. Network access is off by default, and .git and .codex folders stay read-only. Asks before going further.

danger-full-access

No sandbox

Removes the local sandbox. Combined with the yolo option, which bypasses approvals and sandbox together, Codex acts with no checks at all.

SettingValues you will seeWhat a cautious company enforces
Approval policyon-request, never, and a granular table formon-request only, so prompts cannot be switched off
Sandbox or permission profileread-only, workspace-write and danger-full-access, or the profiles :read-only, :workspace and :danger-full-accessFull access left out of the allowed list
Network in the sandboxOff by default in workspace-writeOff, or limited to approved domains through the network proxy rules
Web searchDisabled, cached or liveCached or disabled
MCP serversAny server the user addsNone, or an approved list matched by command or URL
Prompt injection makes these settings matter. A README, an issue or a web page can contain instructions that an agent reads as tasks. With full access and no approvals, those instructions run. More on this in AI coding agent security risks.

Codex identifiers to block on devices

Codex arrives through npm, package managers, an installer and an editor marketplace. A few of the identifiers our files carry for it are shown here.

@openai/codexnpm package of Codex CLI
codexProcess name of the CLI
codex-x86_64-pc-windows-msvc.exeWindows process of Codex CLI
OpenAI.CodexWinGet package ID
codex-appHomebrew cask of the Codex app
openai.chatgptVS Code extension ID of Codex

Six of many. The full file also holds the Codex helper processes, the macOS app, companion tools built on Codex, and the identifiers of every other coding agent we track.

Two ways to handle Codex: block it, or govern it

If your company has a ChatGPT business workspace, you may want Codex under your rules rather than gone. If not, block it with the rest of the category.

A

Block Codex everywhere

  1. Devices: block the WinGet and Homebrew packages and alert on the codex processes with Intune, Jamf or your endpoint tool.
  2. Packages: block the npm package in your internal registry or proxy so new installs fail.
  3. Editors: in VS Code, set the Codex extension ID to false in AllowedExtensions. Installed copies are disabled.
  4. Workspace: if you have ChatGPT Enterprise, turn off Codex local and Codex cloud in the workspace settings. Labels change, so check the current admin console.
  5. Network: blocking openai.com and chatgpt.com also blocks ChatGPT, so do it only if ChatGPT is not approved.
B

Govern Codex with requirements

  1. Write requirements.toml: these are rules users cannot override. The local client falls back to a compliant value and tells the user.
  2. Place it: /etc/codex/requirements.toml on macOS and Linux, or %ProgramData%\OpenAI\Codex\requirements.toml on Windows.
  3. Or deliver by MDM: on macOS, the com.openai.codex preferences domain with the TOML in requirements_toml_base64.
  4. Or from the cloud: business and enterprise workspaces can assign requirements in Admin Console > Agent security to users who sign in with ChatGPT.
  5. Restrict sign-in: allowed_login_methods and allowed_chatgpt_workspaces keep personal accounts out.

A requirements.toml that keeps the guard rails on

This example forces approvals, removes full access, blocks risky commands, hides .env files and SSH keys from sandboxed commands, turns off browser and computer use, and disables MCP. Adjust it, then test on one machine.

allowed_approval_policies = ["on-request"] default_permissions = ":workspace" allowed_web_search_modes = ["cached"] [allowed_permission_profiles] ":read-only" = true ":workspace" = true # ":danger-full-access" is left out, so it is denied [permissions.filesystem] deny_read = ["/**/*.env", "~/.ssh"] [rules] prefix_rules = [ { pattern = [{ token = "rm" }], decision = "forbidden", justification = "Ask a person to delete files" }, ] [features] browser_use = false computer_use = false [mcp_servers] # present but empty: all MCP servers are disabled

Permission profiles need Codex 0.138.0 or later. For older clients in a mixed fleet, OpenAI documents allowed_sandbox_modes with read-only and workspace-write as the legacy equivalent.

Want to allow a few MCP servers instead of none? List each one as its own table under mcp_servers with an identity that matches its command or URL; anything else is disabled. Our MCP allowlist guide explains how to choose them.

Common "how do I stop Codex" questions, answered

Developers and admins search for these one by one. Here they are in one place, with the admin view first.

How to stop Codex from running
Interrupt the current turn from the keyboard as shown in the CLI, or close the session. If a process keeps running, end the codex process. To stop it running again, block it on the device as in path A.
How to disable the Codex sandbox
The danger-full-access mode and the yolo option remove it. On company machines, leave full access out of the allowed profiles in requirements.toml so neither option works.
How to stop Codex asking for permission
The never approval policy stops prompts. Companies usually enforce on-request instead, through allowed_approval_policies, so users keep seeing prompts for risky actions.
How to block specific commands in Codex
Use prefix_rules under [rules] in requirements.toml. Each rule matches a command prefix and sets the decision to prompt or forbidden, with a reason the user sees.
How to disable MCP in Codex
An empty mcp_servers table in requirements.toml disables every MCP server. Users can also remove servers from their own ~/.codex/config.toml, but only the requirement holds.
How to disable Codex in VS Code
Disable or uninstall the extension in the Extensions view. For everyone, set openai.chatgpt to false in the AllowedExtensions policy.
How to turn off web search in Codex
Set allowed_web_search_modes to an empty list in requirements.toml. Only the disabled mode is then allowed.
How to disable the Codex pet
The pet is a display feature of the Codex app. Type /pet to dismiss it or change it under the appearance settings. Hiding it does not turn Codex off.

Codex cloud: what to check on the repository side

Cloud tasks never touch the developer's laptop, so device rules do not reach them. The controls sit in your ChatGPT workspace and in your code hosting.

QuestionWhere to lookSafer setting
Who may start cloud tasks?ChatGPT workspace settings and rolesOff by default, on for named groups
Which repositories are connected?The code hosting app installation for your organisationOnly the repositories a pilot needs
Can changes reach main branches directly?Branch protection and required reviewsEvery agent change goes through a reviewed pull request
Do cloud environments hold secrets?Environment settings for Codex tasksNo production secrets; test credentials only
Can the task reach the internet?Environment network settingsOff, or limited to package registries you trust

Keep Codex away from secrets and production

Even a governed agent should not see what it does not need. Three habits remove most of the risk.

Deny reads

Use deny_read for .env files, key folders and cloud credential files. Remember matches are listed when each sandboxed process starts.

Trim the environment

Shell environment variables reach the commands Codex runs. Keep tokens out of developer shells and load them only where needed.

No production keys

Developer machines that run agents should not hold production credentials. Use short-lived, scoped tokens.

Review every change

Treat agent output like a pull request from a new colleague: reviewed, tested and merged by a person.

The full method, for Codex, Claude Code and Cursor side by side, is in stop AI coding agents from reading .env files and secrets.

Exceptions that hold up in an audit

Some teams will need Codex while the rest of the company does not. Write the exception so that anyone can check it later.

Named people

Who

List the users or the group, not "the platform team". Tie the exception to company accounts in your ChatGPT workspace.

Written limits

How

Record the requirements.toml that applies to them: approvals on, no full access, approved MCP servers only.

End date

Until

Give every exception an owner and a review date. When it lapses, the device block from path A applies again.

How the AI Agent Blocklist covers Codex and the rest

Blocking Codex alone pushes developers to the next agent. Our files list the whole category, so your device and network rules cover them all with one import.

Your toolFile from our downloadWhat you block
Intune, Jamf, endpoint toolsProcess names, WinGet IDs, macOS bundle IDsCodex, Claude Code, Cursor CLI and other agents running on devices
Internal npm or PyPI proxyPackage namesNew installs of command-line agents
VS Code and JetBrains policiesExtension and plugin IDsCoding agent extensions in editors
Firewall, DNS filter, gatewayDomain list, hosts file, firewall listCoding agent and MCP domains, see blocking AI with DNS

Cover Codex and every agent that follows it

The AI Agent Blocklist lists 5,300+ agent identifiers on devices and 2,600+ AI agent domains, each with a risk grade, updated every day.

From $99 a month for one organisation. Download access is set up within one business day of your order.

See plans Ask a question
  • Package and process names of command-line coding agents
  • WinGet IDs and macOS bundle IDs for Intune and Jamf
  • VS Code and JetBrains extension IDs
  • Domain list, hosts file, PAC file and firewall list format
  • CSV and JSON with tool name, category and risk grade

Ask us or order a plan

Tell us what you need to block and where your rules live. We reply within one business day.

  • Files for firewalls, DNS filters, secure web gateways, MDM and browser policies
  • Updated every day as new AI browsers, agents and extensions appear
  • Plans for one organisation, for MSPs and for product makers, or a hosted filter we run for you

We use your details only to answer you. No newsletters.

Questions about blocking Codex

How do I block Codex on company devices?
Block the npm package, the WinGet and Homebrew packages and the codex process on devices, block the Codex extension in VS Code with the AllowedExtensions policy, and turn Codex off for your ChatGPT workspace if you have one. Network blocking of OpenAI domains also stops ChatGPT, so use it only if ChatGPT is not approved.
How do I disable the Codex sandbox?
On company machines you should not. The danger-full-access mode and the dangerously-bypass-approvals-and-sandbox option, also called yolo, remove the sandbox and the approval prompts. Admins block both by leaving danger-full-access out of the allowed permission profiles or sandbox modes in requirements.toml.
How do I stop Codex from asking for permission?
The approval policy named never stops the prompts, and the full access options remove them together with the sandbox. Companies usually want the opposite, so requirements.toml can limit allowed_approval_policies to on-request, and users then cannot switch prompts off.
How do I disable MCP in Codex?
In requirements.toml, an mcp_servers table that is present but empty disables all MCP servers on the local client. To allow only some, list each approved server with an identity that matches its command or URL; any server that does not match is disabled.
How do I disable Codex in VS Code?
A user can disable or uninstall the Codex extension from the Extensions view. For a whole organisation, set the extension ID openai.chatgpt to false in the AllowedExtensions policy, which maps to the extensions.allowed setting, and VS Code disables installed copies.
What is the difference between ChatGPT agent and Codex?
ChatGPT agent works in a browser and computer environment that OpenAI runs, for tasks such as research, forms and shopping. Codex is a coding agent that works on code, either on the developer's machine with access to the shell or as cloud tasks connected to a repository.
How do I turn off the Codex pet?
The animated pet in the Codex app is a display feature. Type /pet in the composer to dismiss it, or change it under Settings and Appearance. Hiding the pet does not turn Codex off.

OpenAI, ChatGPT, ChatGPT Atlas, Codex and Operator are trademarks of OpenAI. Claude Code is a trademark of Anthropic, PBC. Cursor is a trademark of Anysphere, Inc.

VS Code, Intune and Windows are trademarks of Microsoft Corporation. JetBrains is a trademark of JetBrains s.r.o. Jamf is a trademark of Jamf.

macOS is a trademark of Apple Inc. Chrome is a trademark of Google LLC. WinGet is a trademark of Microsoft Corporation. Linux is a registered trademark of Linus Torvalds.

npm is a trademark of npm, Inc. PyPI is a trademark of the Python Software Foundation. Homebrew is a trademark of its owner.

Names are used only to identify the products discussed. AI Agent Blocklist is not affiliated with, sponsored or endorsed by these companies.