Skip to content
IFAI

Open source

OpenAI open-sources Codex Security to hunt and patch code bugs

Published Reach 48

OpenAI just open-sourced Codex Security, releasing a CLI and TypeScript SDK built to find, validate, and patch security vulnerabilities in codebases. It supports scanning entire repositories, specific paths, or git diffs, and can automatically generate fix patches with models like gpt-5.6-sol. The tool itself is free, though running scans requires bringing your own OpenAI API key or account login.

OpenAI open-sources Codex Security to hunt and patch code bugs
Image: github.com

Codex Security is OpenAI's newly open-sourced security analysis tool, shipping as both a CLI and a TypeScript SDK to find, validate, and patch vulnerabilities in your code.

The client-side tools and workflows are completely free and open source. The catch is that the brain behind the scanner requires frontier reasoning. By default, it runs on gpt-5.6-sol with reasoning effort set to high. That means while the tool itself costs nothing, running scans requires bringing your own OpenAI API key or signing in with an account to cover inference costs.

What it does

Traditional static analysis tools are notorious for dumping hundreds of false positives on developers. Codex Security tries to handle the whole loop: detection, verification, and remediation.

Scanning options are flexible. You can run a deep scan across your entire codebase with parallel workers, target specific subfolders using the --path flag, or use --diff in pull request workflows to inspect only incremental changes between Git revisions.

Once a potential vulnerability is flagged, Codex Security does not just leave you with a generic alert. It includes validation workflows to determine whether a finding is genuine, and can generate ready-to-apply patches to fix confirmed flaws.

Beyond bug hunting, it can draft or update your repository's SECURITY.md policy files and export saved threat models alongside scan results. Findings can be exported into standard SARIF, JSON, or CSV formats, or routed directly into GitHub code scanning alerts and issue trackers like Linear.

Getting started

To run it locally, you need Node.js 22.13.0 or higher, plus Python 3.10 or newer. If you are on Python 3.10, you will also need the tomli package installed.

You can install the package globally via npm under @openai/codex-security, which sets up both the codex-security and cs commands. If you prefer not to install anything globally, running npx @openai/codex-security works straight out of the box.

Once installed, run cs login or pass an OPENAI_API_KEY environment variable. From there, running cs scan in your project folder kicks off the analysis. You can also specify an advisory time limit, such as 15 minutes, to keep reasoning depth and API costs predictable.

You are not strictly locked into OpenAI's endpoints either. The scanner supports third-party inference providers including Amazon Bedrock, OpenRouter, and Fireworks AI. With Bedrock, you can authenticate directly through standard AWS credentials.

For automated CI pipelines, OpenAI published a dedicated GitHub Action. Because the scanner can inspect sensitive logic and run dynamic verification steps, the reference workflow sets up Bubblewrap and AppArmor sandboxing on Ubuntu runners to keep the scanning environment locked down.

Why it matters

We think Codex Security addresses the single biggest headache in code security: alert fatigue. Static analysis tools that generate mountains of noise often get ignored. Bringing frontier models into the loop to validate findings and write candidate patches transforms vulnerability scanning from an annoying audit into an active triage partner.

The real trade-off is inference cost. Running deep repository scans with maximum reasoning effort on large codebases will eat through tokens quickly. The smartest move right now is integrating it into CI pull request checks using the --diff flag, focusing frontier intelligence strictly on modified code where the ROI is clearest.

Sources (1)

  1. [1]
    github.com(opens in a new tab)Originalgithub.com

Best of AI, daily