Skip to content
BuildLadder Blog

OpenAI Codex Security CLI: Scan, Validate and Fix Vulnerabilities

What OpenAI's open-source Codex Security CLI does, how to run cs scan, how it compares to Semgrep and Snyk, and why it's trending on BuildLadder.

BuildLadder Editorial8 min readUpdated Nov 18, 2026

Paste this article into your AI assistant and ask it to walk you through it.

On this page
A robot inspects a mechanical connection with a lamp before repairing it.
Illustration created with AI for BuildLadder.

Codex Security is OpenAI's open-source tool for investigating possible security vulnerabilities in a codebase. You can use it from a terminal or through its TypeScript software development kit (SDK). It produces a Markdown report with findings, supporting source code, and limits on what the scan covered.

The basic terminal workflow is to install @openai/codex-security, sign in with cs login, and run cs scan . from your repository. The setup section below includes the required runtimes and options for a smaller scan.

The repository uses Apache-2.0. In the 14 November 2026 BuildLadder daily snapshot, it ranked #3, gaining 751 stars. These are historical observations, not a measure of how thoroughly it will review your code.

What is Codex Security?

It is one security workflow with three ways in, per the README:

  • In Codex: turn on the Codex Security plugin and ask for a scan in plain English. For example: "Run a Codex Security scan on this repository, focusing on authentication and authorization."

  • In a terminal: the cs CLI (codex-security is the long name for the same command).

  • In automation: the TypeScript SDK, a GitHub Action, or Docker Compose bulk scans.

The README lists what it does:

  • Scans whole repos, selected paths, or Git changes. Deep scans repeat Standard scans and deduplicate the findings.

  • Validates candidate findings, generates patches, and verifies existing fixes.

  • Drafts SECURITY.md policies and saves threat models.

  • Rates severity against your own rubric and suggests owners from source and Git history.

  • Imports third-party scanner findings (import guides, Semgrep included).

  • Tracks findings in Linear, Jira or GitHub, and exports SARIF, JSON and CSV.

It isn't locked to OpenAI models. The README says scans also run on Amazon Bedrock, OpenRouter, Fireworks AI and Cheaper Inference.

Who it's for:

  • Indie hackers shipping fast with coding agents who have no security reviewer and want a second pass before launch.

  • Anyone who has inherited a codebase they didn't write and doesn't know where its trust boundaries are.

  • Small teams that want a weekly scheduled scan in GitHub Actions without buying an enterprise AppSec suite.

BuildLadder activity on 14 Nov 2026:

GitHub activity that morning: 13,193 stars, 1,027 forks, TypeScript, Apache-2.0. Repo created 13 July 2026 (UTC), last push 14 November 2026.

npm package: @openai/codex-security is on version 0.10.0, last published 12 November 2026, with 164,980 weekly downloads at fetch time.

Techmeme covered the launch on 29 July 2026 as an early version of the open-source CLI.

Our read: this isn't a one-day spike. The repo is four months old, ships frequently (0.10.0 came out two days before this snapshot), and is back on the daily board because security for agent-written code is a live topic this month. On the same weekly board, cloudflare/security-audit-skill showed +10,700 ★.

How to get started

Everything below comes from the README quick start.

1. Check requirements. You need Node.js 22.13.0+ (within 22.x) or Node.js 24.x or 26.x, plus Python 3.10+. On Python 3.10 you also need tomli.

2. Install and sign in.

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

If cs clashes with another command, use codex-security. To skip the global install, or if npm reports an EEXIST conflict, use npx @openai/codex-security for both login and scanning.

3. Run your first scan from the repo directory:

cs scan .

When the scan finishes, open the Markdown file at the REPORT path the terminal prints. cs scans show finds the latest completed scan again.

4. Narrow or deepen the scope.

cs scan . --path src --path tests   # selected paths
cs scan . --diff origin/main         # only changes since a base revision
cs scan . --mode deep                # deep scan
cs scan . --max-time 15              # advisory 15-minute Standard investigation

5. Write a SECURITY.md and export the threat model.

cs policy .
cs export --scan SCAN_ID --artifact threat-model --output threatmodel.md

cs policy saves its draft outside the repo and leaves existing files alone. You review it and copy SECURITY.md in yourself.

6. Automate it. For CI, set OPENAI_API_KEY or CODEX_API_KEY. The repo includes a weekly GitHub Actions workflow that reads a CODEX_SECURITY_API_KEY secret. Per the README, it uses an estimated $5 limit per scan and reports findings without failing the job. Requests already running can go over that limit.

From TypeScript:

import { CodexSecurity } from "@openai/codex-security";

const security = new CodexSecurity();
try {
  const result = await security.run("/path/to/repository");
  console.log(result.reportPath);
} finally {
  await security.close();
}

One caveat from the README: some cybersecurity requests and protected findings need OpenAI's Trusted Access for Cyber.

What a report contains

The CLI docs on scan scope name the files a retained run leaves behind. report.md is a readable summary of the scope and findings, the Markdown file at the REPORT path. findings.json holds the reported findings, source locations, and supporting evidence. scan-manifest.json records scan.status, scan.target, and scan.scope, the requested inclusions and exclusions. Current scans also list extra excluded paths under scan.review.excludedPaths.

The README says to read that report for source evidence and exclusions, then request a patch or ask Codex to verify an existing fix. A completed scan means the requested workflow finished. It does not mean every file or possible vulnerability was examined. A new scan reviews the current checkout and does not amend the saved report.

When not to use it

The README says the local serve command and browser dashboard have been removed. Existing databases and scan artifacts remain available. If an important path is still unreviewed, the CLI docs say to run a focused scan with --path.

Repeating the same scan does not guarantee that an omission will be resolved, and absence of findings from a stopped run is inconclusive. Files at .github/SECURITY.md or docs/SECURITY.md do not automatically provide repository-wide scan guidance.

Some cybersecurity requests and protected findings require Trusted Access for Cyber.

Codex Security vs Semgrep, Snyk and CodeQL

These tools answer different questions, so a small team may use more than one. SAST means checking source code for security problems without running the application. SCA checks third-party dependencies and their known vulnerabilities or licenses. A CVE is an identifier for a publicly reported vulnerability.

ToolBest atWhere Codex Security differs
SemgrepFast, rule-based SAST and PR gatesCodex Security investigates and validates findings, writes patches, and can import Semgrep results
SnykDependency CVEs, licenses, SASTCodex Security focuses on your own code. Keep a dedicated dependency inventory and advisory scan in your workflow
CodeQLQuery-based analysis built into GitHubCodex Security exports SARIF, so its results fit the same code-scanning workflow
cloudflare/security-audit-skillA multi-phase audit skill run inside your coding agentCodex Security is a standalone CLI/SDK with saved scan history and an Action

Use each vendor's current documentation to confirm which analysis and integrations it provides. The linked comparison discusses the different roles, and their different uses. Try the tools against a known issue in your own repository.

Use Codex Security when you want an agent to investigate a possible vulnerability, explain its evidence, and propose a fix. Consider Semgrep or CodeQL for repeatable source-code checks in your pull-request workflow. Keep dependency and license checks as well; these tools cover different parts of a security review.

For a broader review that writes implementation plans, see shadcn/improve, especially its audit mode. For reusable instructions you install into a coding agent, see Anthropic's official skills repository.

Track it on BuildLadder

Security tooling for agent-written code is having a moment. See today's movers, compare the week and the month, or check where your own shipping streak ranks on the daily builder leaderboard.

FAQ

What is OpenAI Codex Security?

Codex Security is an open-source (Apache-2.0) CLI and TypeScript SDK from OpenAI that scans code for vulnerabilities, validates findings, generates patches, and verifies fixes.

How do I install the Codex Security CLI?

Run npm install --global @openai/codex-security, then cs login, then cs scan . in your repository. It needs Node.js 22.13+, 24.x or 26.x, plus Python 3.10+.

Is Codex Security free?

The CLI is open source under Apache-2.0, but scans call a model provider, so you pay for usage. The official GitHub Action example sets an estimated $5 limit per scan.

Can Codex Security run without an OpenAI account?

Yes. Per the README, scans also support Amazon Bedrock (using AWS credentials), OpenRouter, Fireworks AI and Cheaper Inference.

Does Codex Security replace Semgrep or Snyk?

Not directly. Semgrep is a fast, rule-based gate and Snyk covers dependency risk. Codex Security investigates and patches findings, and it can import Semgrep results.

Sources

Star counts change. The ranks and deltas above are the BuildLadder card values from that 14 Nov 2026 fetch, except the GitHub API star and fork counts and the npm version and weekly downloads, which are from the same morning.

Read next