# AI use cases for Codex Security (openai/codex-security)

Repo: [openai/codex-security](https://github.com/openai/codex-security) | Use cases: 3 | Page: https://dedupedai.com/use-cases/openai-codex-security/

Codex Security helps you find, investigate and fix vulnerabilities in your code. The @openai/codex-security CLI (cs) scans repositories, selected paths or Git changes, validates findings, generates patches, drafts SECURITY.md policies, and exports SARIF, JSON and CSV. A TypeScript SDK and a GitHub Action automate the same workflows.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Scan your repository for vulnerabilities: https://dedupedai.com/use-cases/openai-codex-security/scan-your-repository-for-vulnerabilities-with-codex-security/
- Scan only the changes in a branch: https://dedupedai.com/use-cases/openai-codex-security/check-only-your-pull-request-changes-with-codex-security/
- Run a weekly scan in GitHub Actions: https://dedupedai.com/use-cases/openai-codex-security/run-a-weekly-codex-security-scan-in-github-actions/

## How to scan your repository for vulnerabilities with Codex Security

Repo: [openai/codex-security](https://github.com/openai/codex-security) | Difficulty: Beginner | Time: 30 minutes | Basis: From the README

Install the cs CLI, sign in and run a first scan from your repository directory.

**Who it is for:** A developer who wants a quick security review of a codebase before release.

**The problem:** Manual security review is slow and easy to skip on a small team.

**The outcome:** A saved Markdown report with findings, source evidence and coverage limits.

### Steps

1. Check you have Node.js 22.13.0+ within 22.x, or Node.js 24.x or 26.x, and Python 3.10+
2. Install the CLI with `npm install --global @openai/codex-security`
3. Sign in with `cs login`
4. From the repository directory run `cs scan .`
5. Open the Markdown file at the REPORT path printed in the terminal
6. Find the latest completed scan again later with `cs scans show`

### Prompt to paste into your agent

```text
Using openai/codex-security, install the CLI, run `cs scan .` in this repository, and summarize the findings in the REPORT file with the coverage limits it lists.
```

### Caveat

Review findings yourself; the report lists exclusions and coverage limits.

Risk, cost: Scans use model calls on your account; the README mentions cost limits in `cs scan --help`.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/openai-codex-security/scan-your-repository-for-vulnerabilities-with-codex-security/

## How to scan only the changes in a branch with Codex Security

Repo: [openai/codex-security](https://github.com/openai/codex-security) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Limit a scan to selected paths or to the commits since a base revision.

**Who it is for:** A team that wants a focused check on one feature branch instead of the whole repo.

**The problem:** Whole-repository scans are broad when you only changed a few files.

**The outcome:** A scan scoped to the paths or diff you chose.

### Steps

1. Install with `npm install --global @openai/codex-security` and sign in with `cs login`
2. Scan selected paths with `cs scan . --path src --path tests`
3. Scan committed changes from a base revision with `cs scan . --diff origin/main`
4. Set an advisory time allowance with `cs scan . --max-time 15`
5. Browse every option with `cs scan --help`

### Prompt to paste into your agent

```text
With openai/codex-security, run `cs scan . --diff origin/main` on my branch and list the findings tied to the changed files.
```

### Caveat

The README calls the 15 minute value an advisory allowance, not a hard limit.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/openai-codex-security/check-only-your-pull-request-changes-with-codex-security/

## How to run a weekly scan in GitHub Actions with Codex Security

Repo: [openai/codex-security](https://github.com/openai/codex-security) | Difficulty: Intermediate | Time: 1 hour | Basis: From the README

Schedule a repository scan on GitHub-hosted Ubuntu and export results for CI.

**Who it is for:** A maintainer who wants regular scans without running them by hand.

**The problem:** Security checks that depend on someone remembering to run them get skipped.

**The outcome:** A weekly workflow that scans the repository and reports findings without failing the job.

### Steps

1. Add an OpenAI API key as the repository secret `CODEX_SECURITY_API_KEY`
2. Copy the weekly workflow from github-action/examples/repository.yml to `.github/workflows/codex-security.yml`
3. Replace REPLACE_WITH_REVIEWED_COMMIT with the reviewed distribution commit SHA from an Action release
4. Open Actions, then Codex Security repository, then Run workflow to try it before the next scheduled run
5. Export results for CI with `cs export --scan SCAN_ID --artifact threat-model --output threatmodel.md` or see the export guide for SARIF

### Prompt to paste into your agent

```text
Using openai/codex-security, set up the weekly GitHub Actions workflow from github-action/examples/repository.yml in my repo and tell me which secret and commit SHA I still need to fill in.
```

### Caveat

Pin the Action to a reviewed commit SHA as the README instructs.

Risk, cost: The example uses an estimated 5 dollar limit per scan, and requests in progress can exceed the limit.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/openai-codex-security/run-a-weekly-codex-security-scan-in-github-actions/
