Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Node.js 26.x; Python 3.10 or later; and access to Codex Security.
npm install @openai/codex-security
npx @openai/codex-security login
npx @openai/codex-security scan .
npx @openai/codex-security scan . --patch
npx @openai/codex-security scan . --patch --patch-severity high --json
npx @openai/codex-security scan . --patch --patch-severity high --create-pr
npx @openai/codex-security scan . --model gpt-5.6-terra --effort high
npx @openai/codex-security scan . --scan-prompt-file scan.md --post-scan-prompt-file follow-up.md
npx @openai/codex-security scan . --mode deep --workers 2 --subagents 0 --stop-after-no-new 3 --max-discovery-runs 10 --max-time-hours 1.5
Expand All @@ -26,6 +29,15 @@ For CI, set `OPENAI_API_KEY` or `CODEX_API_KEY` instead of signing in.
Environment API keys are passed directly to the current scan and are never
stored in Codex's credential home or system keyring.

After showing the findings summary, interactive scans with findings ask whether
to open a finding browser where you can inspect full details, choose a severity
threshold, select individual findings, and add patch instructions for each one.
Each selected finding runs in its own saved Codex desktop task.
Use `--patch --patch-severity high` to fix high and critical findings. Add
`--create-pr`, or enable the pull request option during review, to commit the
verified files and open a GitHub pull request. Ordinary scans do not change
repository files.

Deep-scan discovery stops after 96 hours by default. Set `--max-time-hours` to
any positive number of hours, including fractional hours, up to 96. Completed
findings are preserved and returned when the limit is reached.
Expand Down Expand Up @@ -74,6 +86,11 @@ directory outside the repository.
`findings list [repository]` shows open findings across a repository's scans
and identifies findings not confirmed in its latest scan.

Use `patch OCCURRENCE_ID` to fix one saved finding, or
`patch --scan SCAN_ID --severity high` to fix selected findings from a saved
scan. Add `--json` for structured results or `--create-pr` to open a GitHub pull
request after verification.

`scans compare BEFORE_SCAN_ID AFTER_SCAN_ID` automatically matches findings by
root cause, reuses saved matches, and identifies new, persisting, reopened,
resolved, or unknown findings. Missing findings remain unknown when coverage is
Expand Down
44 changes: 37 additions & 7 deletions sdk/typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ Trusted Access for Cyber. To apply or check your access, visit
npx @openai/codex-security scan
npx @openai/codex-security scan /path/to/repository
npx @openai/codex-security scan /path/to/repository --headless
npx @openai/codex-security scan /path/to/repository --patch
npx @openai/codex-security scan /path/to/repository --patch --patch-severity high --json
npx @openai/codex-security scan /path/to/repository --patch --patch-severity high --create-pr
npx @openai/codex-security scan /path/to/repository --model gpt-5.6-terra
npx @openai/codex-security scan /path/to/repository --model gpt-5.6-terra --effort high
npx @openai/codex-security scan /path/to/repository --path src --path tests
Expand Down Expand Up @@ -248,6 +251,10 @@ npx @openai/codex-security validate /path/outside/repository/findings.json "Poss
npx @openai/codex-security validate "Possible SQL injection" --effort high
npx @openai/codex-security patch /path/outside/repository/findings.json "Missing authorization check in src/routes.ts:18"
npx @openai/codex-security patch "Missing authorization check" --effort high
npx @openai/codex-security patch OCCURRENCE_ID
npx @openai/codex-security patch --scan SCAN_ID --severity high --json
npx @openai/codex-security patch --scan SCAN_ID --severity high --create-pr
npx @openai/codex-security patch --scan latest --severity medium
```

Run `npx @openai/codex-security --version` for the installed CLI version or
Expand Down Expand Up @@ -330,6 +337,23 @@ for a passing policy. Incomplete scans still write the available human or JSON
result to stdout and a coverage warning to stderr, including in report-only
mode.

Use `--patch` to fix and verify confirmed findings after a complete scan.
`--patch-severity high` selects high and critical findings; the default is low
and above. After showing the findings summary, interactive scans with findings
ask whether to open a color-coded finding browser with complete finding details
and a separate patch-instructions panel. Use the arrow keys to
browse, `Tab` to inspect details, `Space` to select individual findings, `i` to
edit instructions for the focused finding, `1`–`4` to select by severity, and
`r` to optionally create a GitHub pull request after patching. Press `Enter` to
patch or `q` to keep the checkout unchanged. Each selected finding runs in its
own saved Codex desktop task. Add `--create-pr` to `scan --patch` or a
saved-finding `patch` command to commit only verified patch files and open a
pull request with `gh`. JSON scan results include `patchSeverity`. Scan and
saved-finding results include one `patches` entry per selected finding with
status `verified`, `no_change`, `blocked`, or `failed`, plus `pullRequest` when
one is created. When `--fail-on-severity` is also set, verified and already-fixed
findings no longer fail the policy.

Scans use `gpt-5.6-sol` with extra-high reasoning effort by default. OpenAI is
the implied provider. Use `--model gpt-5.6-terra` to switch models and
`--effort minimal|low|medium|high|xhigh|max` to set reasoning effort. Repeat
Expand Down Expand Up @@ -735,9 +759,10 @@ npx @openai/codex-security scan . \
```

JSON scans never use interactive terminal controls, even when stderr is a TTY.
The `validate`, `patch`, `login`, and `logout` commands reject `--json` because
they do not produce structured CLI output. Sign-in commands remain interactive.
CSV exports cannot be written to stdout while JSON output is requested.
Saved-finding patch commands support `--json`; literal issue and file patch
commands do not. The `validate`, `login`, and `logout` commands reject `--json`.
Sign-in commands remain interactive. CSV exports cannot be written to stdout
while JSON output is requested.

Use `export` to create CSV, JSON, or SARIF from a completed, sealed scan without
starting Codex or loading credentials. Without a scan directory, it exports the
Expand All @@ -751,10 +776,15 @@ Run `npx @openai/codex-security export --help` for all export options.
Use `validate` to run the bundled validation skill on candidate findings and
`patch` to run the bundled fix-finding skill on security issues. Each positional
input can be either a file, whose contents are read into the request, or literal
text. Both commands operate on the current directory, use the scan model
and reasoning defaults, disable plugins, and print the final response without
the underlying Codex event stream. Patching starts a saved task in the Codex
desktop app. Override the model with `--codex 'model="gpt-5.6-sol"'` and the
text. These inputs operate on the current directory. Pass a saved finding or
occurrence ID instead to patch its original repository, or use
`patch --scan SCAN_ID --severity high` for high and critical findings from one
scan. `--scan latest` selects the most recent scan of the current repository.
Saved-finding patch commands accept `--json` and return a verified, already
fixed, blocked, or failed result for each finding. Both commands use the scan
model and reasoning defaults and disable plugins. Patching starts a separate
saved task in the Codex desktop app for each finding. Override the model with
`--codex 'model="gpt-5.6-sol"'` and the
reasoning effort with `--effort high` or
`--codex 'model_reasoning_effort="high"'`.

Expand Down
6 changes: 5 additions & 1 deletion sdk/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
"build": "node --run clean && tsc -p tsconfig.build.json",
"check:package": "node scripts/check-package.mjs",
"format": "prettier --check --ignore-path .gitignore --ignore-path .prettierignore \"**/*.{cjs,mjs,js,ts,json,md}\"",
"format": "prettier --check --ignore-path .gitignore --ignore-path .prettierignore \"**/*.{cjs,mjs,js,ts,tsx,json,md}\"",
"generate:models": "node scripts/generate-models.cjs",
"generate:models:check": "node scripts/generate-models.cjs --check",
"lint": "tsc --noEmit",
Expand All @@ -63,14 +63,18 @@
"fast-uri": "3.1.5",
"fflate": "0.8.2",
"incur": "0.4.13",
"ink": "6.8.0",
"papaparse": "5.5.3",
"pdfjs-dist": "6.2.108",
"react": "19.2.4",
"smol-toml": "1.6.1"
},
"devDependencies": {
"@types/bun": "1.3.13",
"@types/node": "22.19.17",
"@types/papaparse": "5.3.15",
"@types/react": "19.2.14",
"ink-testing-library": "4.0.0",
"json-schema-to-typescript": "15.0.4",
"prettier": "3.2.5",
"typescript": "5.7.3"
Expand Down
Loading
Loading