Scan, verify, and patch security vulnerabilities in your codebase
A single terminal command scans your repository, lets you verify the evidence for any found vulnerabilities, and generates a fix patch in one continuous flow. Codex Security, built by OpenAI, combines a code scanner with security analysis tools to help developers make their own security judgments. This article looks at how the tool works and where it is useful.
Security workflow from scan to patch
Codex Security can scan an entire repository, a specific path, or only Git changes. A standard scan performs basic checks, while a deep scan repeats the standard scan and removes duplicate results to provide more precise output. Once the scan is complete, a report in Markdown format is generated, listing the source code evidence for vulnerabilities and any excluded items. Based on this report, you can generate a patch or verify if an already applied fix is correct. You can also draft a SECURITY.md policy or save a threat model for later review.
Usage in terminal and automation
To use it in the terminal, you need Node.js 22.13.0 or higher (22.x series) or 24.x, 26.x versions, and Python 3.10 or higher. If you use Python 3.10, you must also install the tomli package. After installing the CLI globally, log in with cs login and run your first scan with cs scan .. You can specify a particular folder for the scan scope using --path, or check only changes since a specific commit using --diff. In CI environments, you must set OPENAI_API_KEY or CODEX_API_KEY as environment variables, and headless machines support device login or SSH login. In TypeScript projects, you can install the SDK to automate scans through the CodexSecurity class.
Result management and external system integration
Found vulnerabilities can be tracked in Linear, Jira, or GitHub, and exported in SARIF, JSON, or CSV formats. You can automate weekly repository scans using GitHub Actions, or batch scan multiple repositories in containers using a Docker Compose configuration. If your account has Codex Security Cloud enabled, you can read vulnerabilities and reports stored in the cloud from Codex Desktop or the CLI. This feature is optional, and local scans work normally without a cloud connection. It also supports various providers besides OpenAI, including Amazon Bedrock, OpenRouter, Fireworks AI, and Cheaper Inference; Bedrock can be used with AWS credentials without a separate OpenAI login.
Things to check before use
This tool requires specific versions of Node.js and Python, and some security requests or access to protected vulnerabilities require Trusted Access for Cyber permissions. The GitHub Actions example sets a cost limit of approximately 5 dollars per scan, but ongoing requests may exceed this limit. Local scans work without the cloud, but using cloud features or specific providers requires additional authentication setup. When generating SECURITY.md, existing files are not modified; the draft is saved separately, so you must review the differences before final application. This tool finds security vulnerabilities and helps with fixes, but it does not automatically resolve all security issues, so developers must always review generated patches and reports.