OpenAI has quietly released the source code for Codex Security’s command-line interface and TypeScript SDK . The public package, @openai/cod...

OpenAI has quietly released the source code for Codex Security’s command-line interface and TypeScript SDK.
The public package, @openai/codex-security, is designed to help security and engineering teams:
The repository is published under the Apache License 2.0.
That makes the CLI and SDK code open source. It does not mean that the entire Codex Security service, its underlying models, every protected finding, or unlimited cyber access is now freely available for offline use.
Running scans still requires Codex Security access. OpenAI also says some full-repository scans, protected findings, and advanced cybersecurity requests may require approval through Trusted Access for Cyber.
The distinction is important:
Open-source CLI and SDK
≠
open-weight security model
≠
unrestricted cloud scanning access
Codex Security began as an internal project called Aardvark. It later moved into Codex as a research-preview application-security agent, and the new public package now lets developers bring the scanner into local terminals, internal tools, bulk repository campaigns, pre-commit checks, and CI pipelines.
OpenAI first introduced Aardvark in October 2025 as an agentic security researcher powered by GPT-5.
The original system was designed to work more like a human application-security researcher than a conventional signature scanner.
Instead of only matching code against known patterns, Aardvark could:
In March 2026, OpenAI renamed Aardvark to Codex Security and integrated it into Codex.
The product entered research preview through Codex web for selected ChatGPT plans and connected GitHub repositories.
The later open-source release adds a different deployment layer.
Developers can now install the CLI or import the TypeScript SDK, while the hosted Codex Security cloud experience continues to exist separately.
The public GitHub repository contains:
The package is published through npm as:
@openai/codex-security
The repository’s Apache-2.0 license generally permits use, modification, and redistribution under the license terms.
The release does not provide model weights for GPT-5.6 Sol, Terra, or a dedicated Codex Security model.
The default scan currently uses:
gpt-5.6-sol
reasoning effort: xhigh
The CLI calls an inference service through authenticated access.
The repository also documents provider options such as OpenRouter and Fireworks for selected models, but the Codex Security scanning workflow and protected cyber capabilities may still require OpenAI-side authorization.
Installing the npm package is not the same as receiving permission to run every scan.
OpenAI’s documentation states that:
The public code makes the workflow inspectable and extensible. It does not remove the safety and authorization layer around advanced cyber use.
AI coding agents can generate and modify software faster than many organizations can review it.
That creates a security bottleneck.
A product can move from idea to deployed application in days or hours, while traditional application-security reviews may still depend on:
The problem is not simply that developers lack vulnerability reports.
Many maintainers already receive too many reports, including:
Codex Security is designed around the opposite goal: fewer, more contextual findings with evidence that helps a reviewer decide what to fix.
OpenAI describes the system as a multi-stage application-security workflow.
Codex Security first studies the repository to understand the security-relevant structure of the project.
It attempts to identify:
The result is a project-specific threat model rather than a generic checklist.
Teams can add architecture documents, security policies, focus areas, and known attack vectors to improve this context.
The agent reviews the relevant code while using the threat model to judge realistic impact.
This allows it to reason about issues that may be difficult for a rule-based scanner to understand in isolation.
Examples can include:
The scanner can review:
Where possible, Codex Security attempts to validate high-signal issues in an isolated environment.
Validation can help answer whether:
This step is intended to reduce false positives.
It does not guarantee that every finding has been reproduced or that a completed scan proves the repository is secure.
The scan’s coverage.json file records whether coverage is:
complete
partial
unknown
Reviewers should read exclusions, deferred areas, and open questions before treating a scan as evidence of comprehensive review.
For accepted findings, Codex Security can suggest a patch designed to fit the surrounding system.
The objective is not merely to silence a scanner.
A good fix should:
Codex Security scans are report-only by default. Suggested patches should still go through normal code review, testing, and deployment controls.
The CLI stores scan history and supports finding feedback.
A reviewer can mark a finding as a false positive and record the reason.
Later scans can consider that explanation while checking the current code again.
This helps the scanner adapt to repository-specific facts without permanently suppressing a code path that might become vulnerable later.
OpenAI has published several adoption and quality figures from its preview deployments.
These are company-reported metrics, not independent benchmark results.
OpenAI said that during one 30-day period Codex Security:
| Metric | OpenAI-Reported Result |
|---|---|
| Commits scanned | More than 1.2 million |
| Critical findings | 792 |
| High-severity findings | 10,561 |
| Scanned commits containing critical issues | Less than 0.1% |
OpenAI also reported that beta improvements:
OpenAI later said Codex Security cloud had:
| Metric | OpenAI-Reported Result |
|---|---|
| Codebases scanned | More than 30,000 |
| Commits scanned | More than 30 million |
| Findings manually marked fixed | More than 70,000 |
| Findings automatically determined fixed | More than 500,000 |
The scale is notable, but these figures should not be read as a controlled comparison with CodeQL, Semgrep, Snyk, or human penetration testing.
The tools operate differently and may measure findings, fixes, and coverage in different ways.
Codex Security is now available through several related surfaces.
| Interface | Main Use |
|---|---|
| Codex Security plugin | Interactive scans and remediation in the ChatGPT desktop app or Codex CLI |
| Security workbench | Review saved scans, findings, repository history, coverage, and artifacts |
| Codex Security CLI | Repeatable local, terminal, pre-commit, bulk, and CI workflows |
| TypeScript SDK | Embed scans and lifecycle controls into an application or developer tool |
| Codex Security cloud | Scan connected GitHub repositories through Codex cloud |
The public CLI and SDK use the same general scanner workflow as the plugin, but availability and feature maturity can differ between the plugin catalog, CLI package, and cloud research preview.
The commands below follow OpenAI’s current official CLI documentation.
The CLI requires:
Node.js 22 or later
Python 3.10 or later
Codex Security access
The GitHub repository currently gives more specific supported Node.js ranges, including recent 22.x, 24.x, and 26.x versions.
Check your environment:
node --version
python3 --version
Install Codex Security from npm:
npm install @openai/codex-security
Check the installed version:
npx @openai/codex-security --version
List commands:
npx @openai/codex-security --help
For local interactive use, sign in with a ChatGPT account:
npx @openai/codex-security login
For a remote or headless machine:
npx @openai/codex-security login --device-auth
For CI or another unattended workflow, provide an API key through the environment:
export OPENAI_API_KEY=""
Do not place API keys in source control.
Use a secret manager or the CI platform’s protected-secret system.
When both a stored ChatGPT login and an API key are available, select the desired method explicitly:
npx @openai/codex-security scan . --auth chatgpt
or:
npx @openai/codex-security scan . --auth api-key
Authentication does not automatically grant Trusted Access for Cyber.
OpenAI recommends storing results outside the scanned repository.
Reports may contain:
Prepare the target and results directory:
REPOSITORY=/path/to/repository
SCAN_DIR=/path/outside/repository/codex-security-results
If the default persistent state directory is not writable, choose another private directory:
export CODEX_SECURITY_STATE_DIR=/path/outside/repository/codex-security-state
Verify local paths and scan configuration before starting model work:
npx @openai/codex-security scan "$REPOSITORY" \
--output-dir "$SCAN_DIR" \
--dry-run
The dry run does not start Codex or load scan credentials.
Start a standard repository scan:
npx @openai/codex-security scan "$REPOSITORY" \
--output-dir "$SCAN_DIR"
Request machine-readable JSON on standard output:
npx @openai/codex-security scan "$REPOSITORY" \
--output-dir "$SCAN_DIR" \
--json
By default, Codex Security currently uses:
model: gpt-5.6-sol
reasoning effort: xhigh
A lower-cost configuration can use another supported model and effort level:
npx @openai/codex-security scan "$REPOSITORY" \
--model gpt-5.6-terra \
--effort high
Supported effort settings are:
minimal
low
medium
high
xhigh
Lower effort may reduce time and cost but can also reduce the depth of the review.
A standard result directory can contain:
codex-security-results/
├── scan-manifest.json
├── findings.json
├── coverage.json
├── report.md
├── artifacts/
└── exports/
└── results.sarif
report.mdDescribe your idea once, and We0 AI can generate a showcase site, pages, and CMS, then help you attract customers and traffic after launch.
One complete project generation for free registration
Best for trying one complete generation flow and seeing a first project draft quickly.
The primary human-readable report.
findings.jsonStructured findings, including severity, confidence, affected locations, evidence, and remediation.
coverage.jsonThe reviewed surfaces, exclusions, deferred work, open questions, and completeness assessment.
scan-manifest.jsonThe target, scope, producer information, and sealed artifact references.
artifacts/Supporting vulnerability reports, proof-of-concept files, or related evidence when available.
SARIF can be consumed by GitHub Code Scanning and other compatible security tools.
A large monorepo may not need a full scan every time.
Select specific paths:
npx @openai/codex-security scan "$REPOSITORY" \
--path services/billing \
--path packages/auth
This can be useful when one release affects a defined service or security boundary.
Scan committed changes between a base revision and HEAD:
npx @openai/codex-security scan "$REPOSITORY" \
--diff origin/main \
--head HEAD
The repository argument must point to the Git worktree root, and the required revisions must exist locally.
Scan staged and unstaged changes against HEAD:
npx @openai/codex-security scan "$REPOSITORY" \
--working-tree \
--base HEAD
This is useful before creating a pull request or committing a security-sensitive change.
Run a broader review when the normal scan is not sufficient:
npx @openai/codex-security scan "$REPOSITORY" \
--mode deep
Deep mode takes longer and can consume more model resources.
OpenAI’s current documentation says it supports repository and path targets, not diff or working-tree targets.
Provide internal documentation that helps the agent interpret the system correctly:
npx @openai/codex-security scan "$REPOSITORY" \
--knowledge-base /path/to/architecture.md \
--knowledge-base /path/to/security-policies
Useful context can include:
Do not include secrets unnecessarily.
The files become part of a security-sensitive scan workflow and should follow appropriate retention and access controls.
Set an estimated model-cost limit in U.S. dollars:
npx @openai/codex-security scan "$REPOSITORY" \
--max-cost 5
Requests already in progress may complete after the limit is reached, so the final amount can exceed the threshold.
Codex Security keeps available results when a cost-limited scan stops.
A partial result should not be treated as complete repository coverage.
Install the supplied Git hook:
npx @openai/codex-security install-hook
The hook scans staged and unstaged changes before a commit.
OpenAI says it blocks:
It does not replace an existing pre-commit script.
Teams should review how the hook interacts with local performance, developer access, model cost, and existing lint or test hooks before enabling it across an organization.
Authenticate GitHub CLI first:
gh auth login
Start the interactive repository-discovery flow:
npx @openai/codex-security bulk-scan
The current interactive flow excludes archived repositories and forks and asks for confirmation before scanning.
Use a prepared CSV inventory for a repeatable campaign:
npx @openai/codex-security bulk-scan repositories.csv \
--output-dir /path/outside/repositories/security-scans \
--workers 4
Running the same command again can resume the campaign without rescanning repositories that already have intact result artifacts.
The public repository includes Docker and Compose resources.
Where account access includes the required image and environment, an example bulk command is:
docker compose run --rm codex-security \
bulk-scan /input/repositories.csv \
--output-dir /output \
--workers 4
OpenAI recommends:
Containerization limits some host exposure. It does not make an authorized security scan risk-free.
List previous scans for a repository:
npx @openai/codex-security scans list "$REPOSITORY"
Inspect a saved scan:
npx @openai/codex-security scans show SCAN_ID
Mark a reviewed occurrence as a false positive:
npx @openai/codex-security findings false-positive FINDING_OCCURRENCE_ID \
--reason "The route already checks permissions"
Rerun a saved scan with its original configuration:
npx @openai/codex-security scans rerun SCAN_ID
Match findings by root cause:
npx @openai/codex-security scans match PREVIOUS_SCAN_ID CURRENT_SCAN_ID
Compare the scans:
npx @openai/codex-security scans compare PREVIOUS_SCAN_ID CURRENT_SCAN_ID
The comparison can classify findings as:
A missing finding remains unknown when the later scan did not cover the relevant area.
The same npm package includes an ECMAScript-module TypeScript SDK.
It requires server-side Node.js 22 or later, and scanning also requires Python 3.10 or later.
A basic integration looks like this:
import { CodexSecurity } from "@openai/codex-security";
const security = new CodexSecurity();
try {
const result = await security.run("/path/to/repository", {
outputDir: "/path/outside/repository/results",
});
console.log(result.reportPath);
console.log(result.coverage.completeness);
console.log(result.findings.findings.length);
} finally {
await security.close();
}
The SDK supports longer-running workflows through features such as:
A reusable application should create a client, run the required scans, and close the client to release the isolated runtime.
OpenAI’s official CI guide demonstrates pull-request scanning with GitHub Actions.
The recommended pattern is:
The official example pins a specific package version available at publication time. Teams should update that version deliberately after reviewing release notes rather than automatically running unreviewed security tooling with repository secrets.
A compact representation of the core scan step is:
- name: Scan pull-request changes
env:
OPENAI_API_KEY: ${{ secrets.CODEX_SECURITY_API_KEY }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
SCAN_DIR: ${{ runner.temp }}/codex-security-results
run: |
set -euo pipefail
BASE_REVISION="$(git merge-base "$BASE_SHA" "$HEAD_SHA")"
"$CODEX_SECURITY_BIN" scan . \
--diff "$BASE_REVISION" \
--head "$HEAD_SHA" \
--auth api-key \
--output-dir "$SCAN_DIR" \
--json > "$RUNNER_TEMP/codex-security.json"
This excerpt assumes the runner has already installed and verified the CLI, checked out the pull-request head with full history, and defined CODEX_SECURITY_BIN.
Use the complete official CI guide for a production workflow, including pinned actions, SARIF export, permissions, artifact retention, and fork-safety checks.
Codex Security is not a replacement for every existing security control.
It can complement:
Its distinctive strength is contextual reasoning across repository structure and system intent.
A mature program can use deterministic scanners for high-volume known patterns and an agentic scanner for cross-file logic, exploitability analysis, evidence, and remediation.
No scanner can establish the absence of all vulnerabilities in an arbitrary real-world codebase.
Partial or unknown coverage makes that limitation even more important.
Some findings can be tested in an isolated environment.
Others depend on:
A finding without an automated proof is not automatically false, and a validated proof does not reveal every variant of the bug.
A model can misunderstand architecture, overestimate impact, propose an incomplete patch, or introduce a regression.
Security owners should review evidence and fixes.
The package source is public, but the default scan is not a fully local static binary operating without inference access.
Model usage can create cost, data-handling, and authorization considerations.
The results directory may be more sensitive than ordinary build output.
Do not upload detailed findings, proof-of-concept files, or vulnerable source excerpts to public artifacts.
Use the tool only on repositories and systems you own or have explicit permission to assess.
OpenAI’s access controls do not replace legal authorization.
Codex Security’s biggest conceptual advantage is also a practical requirement.
The agent needs accurate context.
A repository alone may not explain:
Poor context can create poor findings.
Teams should treat the editable threat model and knowledge base as first-class security assets, not optional prompt decoration.
Codex Security is OpenAI’s application-security agent for finding, validating, prioritizing, and helping fix vulnerabilities. It evolved from the internal project Aardvark and is available through a plugin, CLI, TypeScript SDK, and connected-repository cloud workflow.
The CLI and TypeScript SDK are public on GitHub under Apache 2.0. The underlying OpenAI models, hosted cloud service, protected findings, and unrestricted cybersecurity access are not released as open-source or open-weight components.
Anyone can access the public package, but running scans requires Codex Security access. Some full-repository scans or advanced cyber capabilities may also require Trusted Access for Cyber.
The current CLI documentation says scans default to GPT-5.6 Sol with xhigh reasoning effort. Users can select another supported model and effort level, and the public repository also documents selected third-party provider configurations.
Yes. The CLI can scan committed changes between a base revision and a head revision, making it suitable for pull-request workflows. OpenAI also provides an official GitHub Actions guide with SARIF export and artifact preservation.
It can propose bounded fixes and help verify whether a change resolves a finding. Scans are report-only by default, and humans should review, test, and approve patches before merging or deployment.
The repository includes Docker and Docker Compose resources for noninteractive bulk scans. OpenAI recommends private persistent storage, secret management, supported Linux isolation features, and optional AppArmor hardening.
No. Coverage may be complete, partial, or unknown, and no automated scanner can guarantee that a complex application contains no vulnerabilities. Use Codex Security as one layer in a broader secure-development program.
OpenAI has open-sourced the Codex Security CLI and TypeScript SDK, giving developers a public, Apache-2.0 foundation for repository scans, change reviews, scan history, fix verification, bulk campaigns, SARIF export, CI checks, and custom security integrations.
The agent differs from a basic pattern scanner by building repository context and a threat model, searching for vulnerabilities in that context, validating plausible issues where possible, and proposing bounded fixes for human review.
The release is not an unrestricted local security model. Running scans still requires authorized inference access, and some advanced cybersecurity workflows may require Trusted Access for Cyber. Sensitive findings and source excerpts also need careful storage and retention controls.
Codex Security is most useful as part of a layered application-security program—not as proof that a repository is vulnerability-free.
The practical change is that security review can now move closer to the speed of AI-assisted development, provided teams keep authorization, threat modeling, validation, and human approval firmly inside the workflow.
Start from one sentence and have a complete website in minutes.