Scan a repository, selected paths, or Git changes for vulnerabilities. The CLI and TypeScript SDK can validate findings, generate patches, verify fixes, and export results as SARIF, JSON, or CSV. The package includes the Codex runtime and security plugin.
Use Node.js 22.x (22.13.0 or later), 24.x, or 26.x on macOS, Linux, or Windows.
Scans also require Python 3.10 or later. On Python 3.10, install tomli.
npm install --global @openai/codex-securityThe CLI runs as cs or codex-security. To skip the global install, use
npx @openai/codex-security in place of cs in the examples below.
Install the package in your project directory.
npm install @openai/codex-securityBefore 1.0, minor releases may change the public API.
Run cs login to sign in with ChatGPT. With a local SDK installation, run
npx @openai/codex-security login from your project. In CI, set
OPENAI_API_KEY or CODEX_API_KEY in the scan environment.
Some requests require Trusted Access for Cyber.
Run a scan from the repository you want to review.
cs scan .To scan only committed changes from origin/main to HEAD, run
cs scan . --diff origin/main. A completed scan exits with code 0 by default,
even when it finds vulnerabilities. Add --fail-on-severity high to exit with
code 1 for high or critical findings.
Run this ES module from the repository you want to scan.
import { CodexSecurity } from "@openai/codex-security";
const security = new CodexSecurity();
try {
const result = await security.run(".");
console.log(result.reportPath);
console.log(`${result.findings.findings.length} findings`);
} finally {
await security.close();
}By default, results are saved in the private Codex Security state directory.
Open the Markdown report at the CLI’s REPORT path or the SDK’s
result.reportPath. Reports and logs can contain source code, credentials, and
vulnerability details. Review them before sharing.
Scans run with your operating-system permissions. Start them with only the credentials they need because subprocesses can inherit your environment.
- CLI reference for scan options, authentication, and exports.
- Dependency exploitability for checking a CVE or package against your code and captured stacks.
- SDK guide for configuration, progress events, and the full set of examples.
- Security policy for reporting vulnerabilities in this package privately.