How to Detect OpenAI Codex CLI on Employee Laptops

Codex CLI is OpenAI's terminal coding agent. It installs as an npm package or with Homebrew, without admin rights, so software inventories rarely list it. Here are the traces it leaves on each OS, a one-minute read-only check, and the config.toml settings that turn an install into a finding.

By Kuntur team · Published

What Codex CLI is and why security teams care

Codex CLI is OpenAI's open-source terminal coding agent. It reads the code in the folder it starts from, edits files, runs commands and starts MCP servers as the logged-in user, signing in with a ChatGPT account or an OpenAI API key. The same agent also runs in the Codex IDE extension and the Codex desktop app.

Where Codex CLI leaves traces

SignalWindowsmacOSLinux
npm global package@openai/codex under %APPDATA%\npm\node_modules, shim in %APPDATA%\npm@openai/codex under npm root -gSame as macOS
Homebrew-codex in /opt/homebrew/bin or /usr/local/binHomebrew on Linux, if used
Processcodex (the npm package starts a native binary), or node with @openai/codexSameSame
User data%USERPROFILE%\.codex~/.codex~/.codex
Moved data folderThe CODEX_HOME environment variable, when set, replaces ~/.codex
Project files.codex/config.toml and AGENTS.md in a repository
IDE extensionopenai.chatgpt in the VS Code (or Cursor, Windsurf) extensions folder

Inside ~/.codex, config.toml holds sandbox and approval settings, MCP servers ([mcp_servers.*]), model providers and plugins; auth.json holds credentials; sessions/ holds transcripts by date; skills/ and prompts/ hold extensions. One trap: the Codex desktop app also runs a process called codex, from Codex.app on a Mac or an OpenAI.Codex Store package on Windows, and the desktop app and IDE extension share ~/.codex. Count a codex process as the CLI only when its path is an npm or Homebrew location; Kuntur reports the desktop app separately.

Check one machine

Both checks only read files and the process table. They send nothing over the network and change nothing, and they never print the contents of auth.json or config.toml.

Windows (PowerShell)

# Read-only, no network. Run as the user (not SYSTEM).

# 1. Installed? npm global package, then anything named codex on PATH
Test-Path "$env:APPDATA\npm\node_modules\@openai\codex"
Get-Command codex -ErrorAction SilentlyContinue | Select-Object Source

# 2. Running now? Path tells the CLI from the Codex desktop app (WindowsApps\OpenAI.Codex_*)
Get-Process -Name codex -ErrorAction SilentlyContinue | Select-Object Id, Path

# 3. Used? Session transcripts are written per day under sessions\
$c = if ($env:CODEX_HOME) { $env:CODEX_HOME } else { "$env:USERPROFILE\.codex" }
Get-ChildItem "$c\sessions" -Recurse -File -Filter '*.jsonl' -ErrorAction SilentlyContinue |
  Sort-Object LastWriteTime -Descending | Select-Object -First 5 LastWriteTime, Name

# 4. Settings worth a finding (line numbers and patterns only, no values)
if (Test-Path "$c\config.toml") {
  Select-String -Path "$c\config.toml" -Pattern 'danger-full-access', 'approval_policy\s*=\s*"never"', '^\[mcp_servers\.' |
    Select-Object LineNumber, Pattern
}

macOS and Linux (bash)

# Read-only, no network. Run as the user.

# 1. Installed? PATH, npm global, Homebrew
command -v codex
ls -d "$(npm root -g 2>/dev/null)/@openai/codex" 2>/dev/null
brew list --versions codex 2>/dev/null

# 2. Running now? The executable path tells the CLI from Codex.app
for pid in $(pgrep -x codex); do ps -o pid=,comm= -p "$pid"; done
pgrep -fl '@openai/codex'    # the npm launcher, runs under node

# 3. Used? Session transcripts are written per day under sessions/
CODEX_DIR="${CODEX_HOME:-$HOME/.codex}"
find "$CODEX_DIR/sessions" -type f -name '*.jsonl' -mtime -30 2>/dev/null | wc -l

# 4. Settings worth a finding (prints only the matched keys)
grep -noE 'danger-full-access|approval_policy[[:space:]]*=[[:space:]]*"never"|^\[mcp_servers\.[^]]+\]' \
  "$CODEX_DIR/config.toml" 2>/dev/null

Many developers run Codex inside WSL on Windows, so also check WSL distros; How to find Claude Code and Codex in WSL has a script for that. With nvm, fnm or Volta, list ~/.nvm/versions/node/*/lib/node_modules/@openai too.

Settings worth a finding

SettingWhat it meansKuntur finding
sandbox_mode = "danger-full-access"No sandbox: commands can touch the whole machine and the networkAGENT_PERMISSIONS_BYPASS
approval_policy = "never" without a read-only sandboxThe agent never asks before running a commandAGENT_PERMISSIONS_BYPASS
The same keys under [profiles.*]A named profile that switches the guardrails offAGENT_PERMISSIONS_BYPASS (per profile)
[mcp_servers.*]Programs or URLs the agent can call, often with tokens in envMCP inventory and MCP_PLAINTEXT_SECRET
[model_providers.*] with a custom base_urlPrompts and code go to an endpoint other than OpenAIListed as a model provider

The --dangerously-bypass-approvals-and-sandbox flag (alias --yolo) does the same for one run without touching the file, so only process command lines from your EDR show it.

Find it across a fleet

The commands above answer the question for one laptop. Across a fleet, run the same read-only checks from the management tool you already use and collect one line per device. Each of these guides has a tested script that already includes Codex CLI:

Those scripts walk every profile under C:\Users or /Users, because MDM scripts usually run as SYSTEM or root, where %USERPROFILE% and ~ point at the wrong home folder. On Linux, run the bash checks through whatever configuration management you have (Ansible, Salt, a cron job) and loop over /home/* the same way.

How Kuntur detects Codex CLI

Kuntur's catalog identifies Codex CLI by the global npm package, the codex binary, its process and the ~/.codex data folder, and reports the Codex desktop app as a separate tool. The agent also reads config.toml for every user profile: sandbox and approval settings (including profiles), MCP servers, model providers, plugins, marketplaces and skills, plus project .codex/config.toml files.

To check one machine now, the free Kuntur scanner lists Codex CLI together with every other AI tool, extension, local model and MCP server it finds:

  1. Download scan.ps1.
  2. Read it. It's plain text; here's what it does.
  3. Check its SHA-256 against the published hash: Get-FileHash .\scan.ps1 -Algorithm SHA256
  4. Run it: powershell -ExecutionPolicy Bypass -File .\scan.ps1

Windows shortcut, if you trust the source (PowerShell)

irm https://app.kuntur.io/scan.ps1 | iex

macOS and Linux (Terminal)

curl -fsSL https://app.kuntur.io/scan.sh | sh

It needs no account and no admin rights, writes an HTML report to the Desktop (or home folder) and uploads nothing. You can read scan.ps1 or scan.sh before running it; what it collects is documented.

Across a fleet, the Kuntur agent reports the same inventory for every user profile on Windows, macOS and Linux. You mark Codex CLI approved or unauthorized once for the organization, the dashboard shows which machines carry it, and every decision lands in an audit log.

Free for up to 5 endpoints. Pro is US$3 per endpoint per month (or US$30 per endpoint per year) for 10 to 30 endpoints. The trial needs no credit card. Kuntur detects and reports; it does not block or uninstall anything.

FAQ

Where is Codex CLI installed?
Usually as the global npm package @openai/codex (under %APPDATA%\npm\node_modules on Windows or npm root -g elsewhere), or with Homebrew on macOS. Its configuration, credentials and session transcripts are in ~/.codex, or wherever CODEX_HOME points.
How do I check if Codex CLI is installed?
Run Get-Command codex on Windows or command -v codex on macOS and Linux, and look for the npm package @openai/codex and the ~/.codex folder. Check the path of any codex process: the Codex desktop app uses the same name.
Which Codex settings turn off its guardrails?
sandbox_mode = "danger-full-access" and approval_policy = "never" in ~/.codex/config.toml or one of its profiles, or the --dangerously-bypass-approvals-and-sandbox flag for a single run. Kuntur reports the settings as AGENT_PERMISSIONS_BYPASS.
Is it safe to read ~/.codex/auth.json during an audit?
Check that it exists and when it changed, but do not print it: it holds the user's sign-in tokens or API key. The checks on this page only list file names, dates and matching setting names.

Sources

  1. OpenAI Codex CLI on GitHub (install, configuration, sandbox and approvals)
  2. OpenAI developers: Codex CLI

Detect other AI tools:

Related guides: