Agent Upstart

Cool things people are building with agents — and practical help getting the most out of them.

Playbooks · Coding tasks

Codex Security scans a repo and patches it

Written November 13, 2026

OpenAI's Codex Security finds vulnerabilities, validates them, writes patches and verifies the fix — from Codex, a CLI, an SDK, or Actions.

What it is

Codex Security is OpenAI's security scanner for code repositories, published as an open source project under the Apache-2.0 licence. The project README states its job in one line: it helps you find, investigate, and fix vulnerabilities in your code. The same scanning workflows run in four places — inside Codex itself, from a terminal CLI, through a TypeScript SDK, and as a GitHub Action — so a team can start interactively and move the same work into automation later.

The loop: scan, validate, patch, verify

Most scanners stop at a list of findings. This one is built as a loop with four steps:

Findings do not have to stay inside the tool. They can be tracked in Linear, Jira, or GitHub, and exported as SARIF, JSON, or CSV. The scanner can also draft a SECURITY.md policy and save threat models alongside scan results, and scans read existing SECURITY.md guidance when a repository already has one.

Install and first scan

The CLI needs Node.js 22.13.0 or later within the 22.x line, or Node.js 24.x or 26.x, plus Python 3.10 or later. Install it globally and sign in:

npm install --global @openai/codex-security
cs login

Then run a scan from the repository directory with cs scan . — the cs and codex-security commands are the same CLI, and npx @openai/codex-security works where a global install is not wanted. In CI, the scan process reads an OPENAI_API_KEY or CODEX_API_KEY from its environment. The repository's GitHub Actions material runs a weekly scan on GitHub-hosted Ubuntu, with the example workflow carrying an estimated $5 limit per scan and reporting findings without failing the job.

Ways to run a scan

The scan command takes a scope. cs scan . --path src --path tests scans selected paths. Adding --diff origin/main scans the committed changes from a base revision to HEAD, which is the shape a pull request review wants. --mode deep runs the deep scan, and --max-time 15 sets an advisory 15-minute allowance for a standard investigation. Inside Codex itself, the route is conversational: open the repository in a session with the Codex Security plugin enabled and ask for a scan — the README's example asks for one focused on authentication and authorization, returning the saved report, source evidence, and coverage limits.

For fleets rather than single repositories, the project ships a containerized bulk scan setup, driven by its included Docker Compose configuration, which keeps results and authentication between runs. Findings and threat models stay saved with each scan, and a saved threat model can be exported later without starting a new analysis.

Limits worth knowing

Related playbooks

Sources

Back to: Coding playbooks hub · Also: Codex Guardian v3: the evidence pipeline in 0.168 · Codex CLI 0.169: side-chat tabs in the terminal