Codex Security CLI
@openai/codex-security is a CLI and TypeScript SDK that uses Codex/LLM agents to scan codebases for vulnerabilities, draft repository-specific SECURITY.md policies, deduplicate findings via embedding similarity, and classify severity against a custom rubric. It supports self-hosted deployment via Docker Compose with a findings service (SQLite-backed dashboard) and can run against multiple inference providers including Amazon Bedrock, OpenRouter, and Fireworks in addition to OpenAI.
What it is
@openai/codex-security — OpenAI's CLI/TypeScript SDK for defining security policy and finding, validating, and fixing vulnerabilities. Beyond scanning, it generates SECURITY.md policy drafts, runs a standalone findings service, deduplicates findings across repositories, and classifies severity against a custom rubric. Some requests and "protected findings" are gated behind OpenAI's Trusted Access for Cyber program (join at chatgpt.com/cyber).
Preconditions / Affected
- Node.js 22.13.0+ and Python 3.10+.
- Interactive use requires
codex-security login; CI usesOPENAI_API_KEYinstead. - Certain cybersecurity requests require Trusted Access approval — a gate the summary omits.
What to do
Install and run a basic scan:
npm install @openai/codex-security
codex-security login
codex-security scan /path/to/directoryGenerate policy guidance (repository-wide or component-scoped):
codex-security policy .
codex-security policy . --path services/api --knowledge-base architecture.mdNote the ordering constraint: policy saves a draft outside the checkout — it does not install it or run a scan. Review the diff before copying. Supporting threat-model/architecture docs stay outside the repo and may hold sensitive detail.
Publish and dedupe against a findings service:
codex-security publish scan --to custom --findings-url http://localhost:3000dedupe retrieves candidates, runs independent Codex reviews locally, and persists accepted groups; --all-repositories widens scope.
Classify severity before filing tickets:
codex-security classify-severity --scan SCAN_ID --rubric /path/to/policy.mdThis checkpoints each finding in SQLite and reuses assessments on rerun; --reprocess forces reassessment.
Alternate inference providers (verbatim examples):
codex-security scan . --provider amazon-bedrock --model openai.gpt-5.6-luna
codex-security scan . --provider openrouter --model anthropic/claude-sonnet-4.5
codex-security scan . --provider fireworks --model accounts/fireworks/models/qwen3-235b-a22bFor many repos, use the Docker Compose config. Run the findings service without Docker via codex-security serve (see "running without Docker" for credentials/storage). The service and scanner share the ghcr.io/openai/codex-security image; the findings service uses a separate container/volume via compose.findings.yaml.
Caveats
classify-severityleaves the original scan severity unchanged; it only produces a separate rubric-based assessment.- The
/dashboardis read-only and refreshes every five seconds. - Duplicate detection is embedding-similarity within a repo unless
--all-repositoriesis set, and accepted duplicates still require an independent local Codex review.
Technologies named here
- @openai/codex-security
- Node.js
- Python
- Codex Security findings service
- Docker Compose configuration
- Trusted Access for Cyber
- OpenAI Codex
- Docker
- SQLite
- OpenRouter
Techniques named here
- npx @openai/codex-security scan /path/to/directory
- npx @openai/codex-security dedupe
- SDK security.run
- npx @openai/codex-security serve
Related in AI Security
