codex-security is a free, open source ai security & privacy project written in TypeScript and released under Apache-2.0. It has 10,750 GitHub stars, 797 forks and 220 open issues, and was last pushed 4 hours ago. On this registry it ranks #5 of 34 tracked projects in AI Security & Privacy, with 5 head-to-head comparisons available. It gained 29 stars over the last 3 tracked days.

What is codex-security?

Codex Security is OpenAI's command-line tool and TypeScript SDK, published on npm as @openai/codex-security, that finds, validates, and fixes security vulnerabilities in a codebase, and it serves application security engineers, DevSecOps teams, and developers who want that scanning to run from their own terminal or CI.

What it is

Codex Security is a TypeScript project under the Apache-2.0 licence that ships as both a CLI and a JavaScript/TypeScript package. It lets a team declare security policy for a repository and then scan a directory, returning a report path through the SDK. It lives in OpenAI's Codex ecosystem and is filed under topics including ai-security, application-security, code-scanning, and devsecops. It requires Node.js 22.13.0 or later and Python 3.10 or later, and it can also use Amazon Bedrock, OpenRouter, or Fireworks for inference.

The concrete problem is that repository-level security review is usually a manual, per-directory exercise with no durable record of what was found, which findings are duplicates, or how severe they are under a team's own policy. Codex Security answers that with a scan command, a findings service that stores findings and embeddings in SQLite, duplicate detection by embedding similarity, and a severity classification step that reassesses selected findings against a rubric the user supplies. The facts provided name no specific competing product that it replaces, so what it removes from the workflow is the improvised scan-and-triage pass that teams otherwise assemble themselves.

Key capabilities

  • codex-security scan /path/to/directory runs a scan after codex-security login, or with OPENAI_API_KEY set in CI.
  • codex-security policy . drafts repository-wide or component-scoped SECURITY.md guidance for future scans, using --path services/api for a component and --knowledge-base architecture.md for supporting context; the draft is saved outside the checkout and no scan runs.
  • The SDK's CodexSecurity class runs run() with options such as mode: "deep", workers, subagents, stopAfterNoNew, maxDiscoveryRuns, and maxTimeHours, and returns a result.reportPath.
  • An included Docker Compose configuration on the ghcr.io/openai/codex-security image handles bulk scans of many repositories, and the same image backs the workflow runner example for individual CLI stages with durable state.
  • codex-security serve starts the findings service (preview) without Docker, storing findings and embeddings in SQLite and serving a read-only /dashboard that refreshes every five seconds and shows stored findings and duplicate groups.
  • codex-security publish scan --to custom --findings-url http://localhost:3000 uploads completed findings, codex-security dedupe persists accepted duplicate groups, and codex-security classify-severity --scan SCAN_ID --rubric /path/to/policy.md assesses findings under a user's own policy, checkpoints each finding in SQLite, and leaves original scan severity unchanged.

Who uses it and how

  • Application security and DevSecOps engineers run it in CI, setting OPENAI_API_KEY rather than signing in interactively.
  • Teams scanning many repositories use the included Docker Compose configuration for bulk scans, or the workflow runner example when they need durable state and a separately deployed findings service.
  • Triage teams deploy the findings service as its own container and state volume via compose.findings.yaml, read the dashboard, and publish tickets only after severity classification under their own rubric.
  • Organizations routing inference elsewhere use --provider amazon-bedrock --model openai.gpt-5.6-luna, --provider openrouter --model anthropic/claude-sonnet-4.5, or Fireworks with the matching API key variable; some cybersecurity requests and protected findings need approval through Trusted Access for Cyber.

Getting started

Install with npm install @openai/codex-security on Node.js 22.13.0 or later with Python 3.10 or later, then run codex-security login and codex-security scan /path/to/directory; in CI, set OPENAI_API_KEY instead. Bulk scans use the included Docker Compose configuration and the ghcr.io/openai/codex-security image.

How it compares

The facts provided list no paid products that Codex Security replaces and name no comparable tool, so it stands alone in this registry. Any comparison against commercial scanners would have to come from sources outside these facts.

When to use it — and when not to

A self-hoster operates more than one binary: the findings service runs as a separate container with a state volume configured by compose.findings.yaml, keeps its data in SQLite, and needs its own credentials and storage configuration, while the CLI needs both Node.js 22.13.0 or later and Python 3.10 or later. Teams that cannot send source code to OpenAI, Amazon Bedrock, OpenRouter, or Fireworks should not adopt it, and the findings service is explicitly a preview. Note also that codex-security policy only drafts guidance outside the checkout, so the proposed diff must be reviewed before it is copied.

project readme (upstream, from github) — read inline

Codex Security

@openai/codex-security is a CLI and TypeScript SDK for defining security policy and finding, validating, and fixing security vulnerabilities in your code.

👉👉 See the Codex Security documentation for full documentation.

Some cybersecurity requests and protected findings require approval through Trusted Access for Cyber. To join the program, visit chatgpt.com/cyber.

Quick start

Requires Node.js 22.13.0 or later and Python 3.10 or later.

npm install @openai/codex-security
codex-security login
codex-security scan /path/to/directory

For CI, set OPENAI_API_KEY instead of signing in.

Generate SECURITY.md

Draft repository-wide or component-scoped SECURITY.md guidance for future scans:

codex-security policy .
codex-security policy . --path services/api --knowledge-base architecture.md

The command saves a draft outside the checkout; it does not install it or run a vulnerability scan. Review the proposed diff before copying the policy. Supporting architecture, threat-model, and review documents stay outside the repository and may contain sensitive details. See the SDK policy guide for headless generation, saved artifacts, and SDK usage.

TypeScript SDK

Codex Security is a Javascript package:

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

const security = new CodexSecurity();
const result = await security.run("/path/to/directory");
await security.run("/path/to/directory", {
  mode: "deep",
  workers: 2,
  subagents: 0,
  stopAfterNoNew: 3,
  maxDiscoveryRuns: 10,
  maxTimeHours: 1.5,
});

console.log(result.reportPath);
await security.close();

Containerized bulk scans

Use the included Docker Compose configuration for scans of many repositories. See the container quick start for more detail.

For individual CLI stages with durable state and access to a separately deployed findings service, use the same scanner image with the workflow runner Compose example.

Findings service (preview)

Run codex-security serve to start the service without Docker. See running without Docker for prerequisites, credentials, and storage configuration.

The findings service runs from the same ghcr.io/openai/codex-security image as the scanner (or a local source build), with a separate container and state volume configured by compose.findings.yaml. It stores findings and embeddings in SQLite and lists findings with pagination. Its read-only dashboard at /dashboard refreshes every five seconds and shows stored findings and duplicate groups from the service's database. It also returns potential duplicates by embedding similarity within a repository or an explicit all-repository scope. The codex-security publish scan --to custom --findings-url http://localhost:3000 command uploads completed findings and their repository ID. The SDK and codex-security dedupe command retrieve candidates, run independent Codex reviews locally, and persist accepted duplicate groups; --all-repositories opts into the broader scope.

Use codex-security classify-severity --scan SCAN_ID --rubric /path/to/policy.md to assess selected findings under your own policy before publishing tickets. Scan classification checkpoints each finding in SQLite and reuses matching assessments on reruns; --reprocess forces reassessment. The SDK exposes the same classification operation; original scan severity stays unchanged. See severity classification.

Other providers

To use another inference provider, set its API key and select a model:

export AWS_BEARER_TOKEN_BEDROCK="<your-bedrock-api-key>"
export AWS_REGION="us-east-2"
codex-security scan . --provider amazon-bedrock --model openai.gpt-5.6-luna

export OPENROUTER_API_KEY="<your-openrouter-api-key>"
codex-security scan . --provider openrouter --model anthropic/claude-sonnet-4.5

export FIREWORKS_API_KEY="<your-fireworks-api-key>"
codex-security scan . --provider fireworks --model accounts/fireworks/models/qwen3-235b-a22b

Documentation

👉👉 See the Codex Security documentation for full documentation.

See project configuration for reusable YAML/JSON settings, CLI overrides, and editor schema support.

Frequently asked questions

Is codex-security free to use?

codex-security is open source under the Apache-2.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does codex-security do?

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-se

What is codex-security written in?

codex-security is primarily written in TypeScript. Its source is publicly available at https://github.com/openai/codex-security, and it has 10,750 GitHub stars.