What is the Codex Security CLI?
OpenAI launched Codex Security as a hosted product earlier this year – its 30-day beta reportedly analysed more than 1.2 million commits across external repositories. At the end of July it took the next step and open-sourced the client side: the Codex Security CLI and a TypeScript SDK, published under the Apache-2.0 licence.
The idea is simple: point an AI model at your code, have it look for real vulnerabilities rather than style nits, and check whether proposed fixes actually close the hole. Here’s what the open-source release gives you and where the limits are.
What it can scan
The codex security cli works at three levels of scope:
- Whole repository – a full assessment, useful as a one-off audit or a scheduled job.
- Selected paths – target the parts of a codebase you care about, such as an auth module or an API layer.
- Git diffs – scan only what changed relative to a branch such as
origin/main, which is what makes it practical for pull requests.
The README’s basic invocation is a repo scan from the project root:
npm install -g @openai/codex-security
codex-security scan .
Flags and options are still moving while it’s in beta, so check codex-security --help and the repository docs for the current syntax rather than copying commands from older write-ups.
Using it in CI
Diff scanning is where this gets interesting for teams. Run it in a CI job against the pull request’s changes and you get a security review on every PR without anyone remembering to ask for one. Coverage of the release also describes using findings to gate a merge – failing the job when a vulnerability is reported.
There isn’t a turnkey PR bot in the box, so think of it as a scanner you wire into your existing pipeline (GitHub Actions, GitLab CI, whatever you run) rather than an app you install. A reasonable starting pattern:
- Run the diff scan on every pull request, reporting but not blocking at first.
- Review the findings for a few weeks to get a feel for the false-positive rate on your codebase.
- Only then turn on blocking, ideally for high-severity findings only.
Requirements
- Node.js 22 and Python 3.10 or newer.
- Access to OpenAI models, either by signing in with ChatGPT or with an OpenAI API key.
- Acceptance that it’s a beta: behaviour, output format and pricing can change.
The privacy trade-off
“Open source” here means the client is open. The analysis itself still runs on OpenAI’s hosted models, so the code being scanned is sent to OpenAI. For a lot of projects that’s fine; for regulated code or anything under a strict NDA, check your policy first.
OpenAI’s own documentation also warns that scan results can contain source excerpts and vulnerability details, and recommends storing output outside the repository, somewhere private, with a sensible retention policy. Don’t commit reports, and don’t paste them into public issues – a list of unpatched vulnerabilities is exactly what an attacker would want.
How it compares
The codex security cli is part of a wider wave of AI vulnerability-discovery tools this year, alongside projects like Hadrian’s OpenHack (MIT-licensed, designed to run inside Claude Code, Codex or Cursor) and OWASP’s new OASIS initiative, which focuses on getting AI-generated fixes validated and merged upstream. Traditional SAST tools are still faster, cheaper and deterministic, so the most practical setup is both: keep your existing scanners for the known patterns and use an AI reviewer to catch logic flaws and context-dependent bugs they miss.
Should you try it?
If you already use OpenAI models and you’re comfortable with your code leaving your network for analysis, it’s a low-effort experiment: install it, scan a repository you know well, and see whether the findings are real. Judge it on precision – an AI reviewer that cries wolf gets ignored quickly – and only wire it into CI once it has earned that place.

Leave a Reply
You must be logged in to post a comment.