Updated 2026-11-21. The Codex Security CLI does not replace the scanners your team already runs. It reads their reports, normalises the findings, and states that the imported evidence is not assessed yet [3]. What it adds is a three-code severity gate, a validation pass from source evidence, and patch and verify-fix commands.
This post answers the practical question a team asks before wiring it in: what does the gate actually do to a build, and what breaks it.
# .github/workflows/security.yml name: Security gate on: pull_request: schedule: - cron: "23 7 * * 1" permissions: contents: read # the action reads the repository; it does not write to it jobs: codex-security: runs-on: ubuntu-24.04 # GitHub-hosted x64, as the action documents [2] timeout-minutes: 120 steps: - uses: actions/checkout@v7 with: persist-credentials: false - uses: openai/codex-security@<reviewed-commit> with: scope: repository model: gpt-5.6-sol effort: high max-cost: "5" fail-on-severity: high env: OPENAI_API_KEY: ${{ secrets.CODEX_SECURITY_API_KEY }}
Four of those inputs are doing real work. fail-on-severity: high is what turns findings into a failed check; the action's own example runs with fail-on-severity: none, so a team that installs it and assumes it blocks is running a report [2]. max-cost is an estimated limit rather than a hard stop, and the documentation says requests already in progress can exceed it [2]. effort and model are the two dials that move both the bill and the quality of the review. And the pinned commit matters because the action's own guide asks you to review a distribution SHA rather than tracking a branch [2].
fail-on-severity: high
fail-on-severity: none
max-cost
effort
model
The documented table is short: a completed scan exits 0 by default, --fail-on-severity high returns 1 for high or critical findings, and execution, target-integrity or required-output failures exit 2 [1]. The interesting part is what those codes do under a real failure, so I ran the CLI in a scratch repository and measured the codes unpiped.
0
--fail-on-severity high
1
2
$ npx --yes @openai/codex-security@0.10.0 scan . --dry-run [0] configured target, no analysis started $ npx --yes @openai/codex-security@0.10.0 scan . [2] Codex could not run a command in its sandbox: bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted ... unprivileged user namespaces are restricted (kernel.apparmor_restrict_unprivileged_userns=1 on Ubuntu 24.04 and later) $ npx --yes @openai/codex-security@0.10.0 scan . --fail-on-severity high [2] same sandbox failure $ npx --yes @openai/codex-security@0.10.0 scans show [2] codex-security: No completed scans found for the current repository.
Two of those results change how a pipeline should be written.
A failed scan and a found issue are different exit codes, and 1 is the only one that means "findings". That is a deliberate design: the documentation says to use manifest.scan.status and the exit code together to "distinguish execution failures from findings-policy violations" [1]. In CI terms, exit 2 means the check did not run. A workflow that treats any non-zero code as a security failure will report a sandbox problem as a vulnerability, and one that treats any non-zero code as an infrastructure problem will swallow real findings. Branch on 1 and 2 separately.
manifest.scan.status
--fail-on-severity does not mask an execution failure. The third run above asked for a high-severity gate and still exited 2, because the sandbox never started. The threshold is applied to findings the scan produced, not to scans that failed to start.
--fail-on-severity
The sandbox error in that transcript is the one that will stop a self-hosted runner first, and it is not a Codex Security bug: Ubuntu 24.04 restricts unprivileged user namespaces, and Bubblewrap needs them. The action's guide carries an "Ubuntu sandbox setup" section for host runners, and the CLI's own message names the kernel setting [1][2]. On a GitHub-hosted ubuntu-24.04 runner the action handles this; on your own hardware, plan the setup as part of the rollout rather than as a surprise on the first scan.
ubuntu-24.04
Most teams end up with a read-only scanner that already fails builds and a Codex Security scan that adds deeper review. The two gates do not behave the same way, and the difference is worth measuring once in your own repository rather than trusting two documentation pages.
#!/usr/bin/env bash # verify-gates.sh - run both gates and assert the exit codes. # Run from the repository root. Needs semgrep on PATH and npx available. set -u fail=0 # Semgrep OSS: findings alone do not fail the build. --error is the gate. semgrep scan --config rules.yml --json > /tmp/semgrep.json 2>/dev/null [ $? -eq 0 ] || { echo "semgrep: unexpected failure code from a clean run"; fail=1; } semgrep scan --config rules.yml --error --json > /dev/null 2>&1 code=$? [ "$code" -eq 1 ] || { echo "semgrep --error: expected 1 on findings, got $code"; fail=1; } # Codex Security: 0 clean, 1 findings at or above the threshold, 2 did not run. npx --yes @openai/codex-security@0.10.0 scan . --fail-on-severity high --json > /tmp/cs.json 2>/dev/null code=$? case "$code" in 0) echo "codex-security: clean" ;; 1) echo "codex-security: findings at or above high" ;; 2) echo "codex-security: the scan did not run, treat as an infrastructure failure"; fail=1 ;; *) echo "codex-security: unexpected code $code"; fail=1 ;; esac exit "$fail"
Run against the same two files in my scratch repository, the two tools produced these codes. Semgrep OSS 1.186.0 found both issues and exited 0; adding --error made it exit 1; asking for --severity ERROR filtered to one finding and still exited 1.
--error
--severity ERROR
$ semgrep scan --config rules.yml --json repo/app.py ; echo $? Ran 2 rules on 1 file: 2 findings. 0 $ semgrep scan --config rules.yml --error --json repo/app.py ; echo $? Ran 2 rules on 1 file: 2 findings. 1 $ semgrep scan --config rules.yml --severity ERROR --error repo/app.py ; echo $? Ran 1 rule on 1 file: 1 finding. 1
And when the configuration itself is wrong, Semgrep does not use 2. It exited 7 and reported the reason:
7
$ semgrep scan --config /tmp/nope.yml --json repo/app.py ; echo $? "message": "WARNING: unable to find a config; path `/tmp/nope.yml` does not exist" "message": "invalid configuration file found (1 configs were invalid)" 7
So the two programs agree on the most important property, that findings do not fail a build unless you ask them to, and they disagree on the code for a broken run: 2 from Codex Security, 7 from Semgrep here. A gate that branches only on 1 is portable; a gate that treats every non-zero code as a finding is not. This is also why the verification script asserts each code instead of checking that the command succeeded.
For the record on the format side, Semgrep's --sarif -o output is SARIF 2.1.0 with one run, the tool listed as Semgrep OSS, and one result per finding. Codex Security writes SARIF to <scan-dir>/exports/results.sarif, and its documentation notes that if that export fails, the scan can still complete, with an export command to write or retry it from the saved results [1]. If your pipeline uploads SARIF to GitHub code scanning, one tool's export failure is a missing upload rather than a failed scan [6].
--sarif -o
run
Semgrep OSS
<scan-dir>/exports/results.sarif
export
This is the part that answers the replacement question. The CLI reads saved reports from fifteen readers, listed in its own help: Wiz, Armorcode, Snyk, Semgrep, Trivy, Opengrep, Endor, GitHub, Inspector, BlackDuck, Veracode, Sonar, Continuum, Checkmarx and Tenable, with OpenGrep findings read through the Semgrep provider [3][4].
I ran this against the real Semgrep JSON report from the previous recipe:
$ codex-security publish findings semgrep.json --provider semgrep \ --source-key demo/rules --repository . \ --source-repository-url https://github.com/example/ci-lab \ --to local --dry-run Local repository: /tmp/ci-lab Source: semgrep / demo/rules Read: 2 Ready: 2 Excluded: 0 semgrep-location:9eafe94086ddd0299ef64609007717a59eb4ea8bf2cf5c1d09bcc7b662af8508 [high] shell-injection-from-input semgrep-location:cc6548d9f751bd891cc43cf4ff4c2364fa70b3f93aeea240c1ad8f813d7b875c [medium] hardcoded-token Evidence file: /tmp/ci-lab/semgrep.json Imported evidence remains not assessed by Codex. Use --dry-run --format json to inspect all normalized findings and complete evidence before storing them. Dry run complete. No findings stored.
Read the last three lines as the design statement. The import normalised two findings, carried Semgrep's severities across as [high] and [medium], produced stable per-location identifiers, and then said the imported evidence is not assessed. The scanner keeps its own verdict, and --dry-run is the default way to look before you store anything.
[high]
[medium]
--dry-run
The flags are less optional than they look, and the errors are explicit. Dropping the source URL:
$ codex-security publish findings semgrep.json --provider semgrep --source-key k \ --repository . --to local --dry-run ; echo $? codex-security: Semgrep sourceRepositoryUrl (--source-repository-url) must be nonempty text. 2
A provider name that does not exist returns the full list, which is how I confirmed the fifteen readers:
$ codex-security publish findings semgrep.json --provider nosuchscanner ... "message": "Invalid option: expected one of \"wiz\"|\"armorcode\"|\"snyk\"|\"semgrep\"|\"trivy\"|..." 2
Two neighbouring paths are worth knowing before you choose one. If your findings already live in a platform, the import command has live collectors for GitHub code scanning alerts, Semgrep's platform through its Web API, Snyk, Sonar and Continuum, and the Sonar collector can replay a saved capture without connecting to Sonar [3][4]. The Semgrep collector is not a file reader, which is a distinction I got wrong before running it: given a local file it stopped with Missing required option --ref. and asked for a deployment slug, because it reads a full project and ref through the API rather than a report on disk [4]. If your Semgrep runs in OSS mode on a runner, the saved-report path above is the one that applies to you.
import
Missing required option --ref.
The GitHub collector is described in the CLI's own help as reading code scanning alerts "without changing GitHub" [4]. That read-only posture is the right default for the first month: bring the findings in, keep your existing gate as the thing that blocks, and let the new scan comment rather than decide.
Three limits are worth stating plainly, because each one shapes the rollout.
The deep half of the tool needs credentials and a sandbox. Every run above that expected analysis exited 2 in my environment, and the reason was the sandbox rather than the model or the key. Plan for a runner where unprivileged user namespaces work, and check the provided container profile and Compose override if you deploy it in a container [2].
Validation is deliberately separate from the gate. The validate command assesses findings from source evidence, and the documentation says its assessments are not applied to the saved findings or to the --fail-on-severity decision, with validation failures exiting 2 while retaining the completed scan [1]. Its extra model calls are also not cost-tracked, which is exactly the kind of line that turns a $5 estimate into a larger number. If you want the gate to reflect validation, that is a second decision you make in the pipeline, not a flag.
validate
Cost is estimated rather than capped. max-cost is an estimate, in-progress requests can exceed it, and the useful habit is what we wrote about in the cost of work you did not ask for: run it on pull requests with a small limit first, look at the actual numbers for a week, then widen the scope.
patch
verify-fix
The honest summary of that table is that the two tools occupy different halves of the job, and the failure mode to avoid is treating the new one as an upgrade rather than an addition. Keep the scanner that already gates your builds. Point the new scan at pull requests with a report-only threshold first. Then decide, from your own numbers, which checks deserve to block.
Does it replace Semgrep, Snyk or Sonar? It reads their reports and adds validation, patching and a three-code gate. It does not ship their rule ecosystems, so the sensible arrangement is both, with one gate that blocks.
Why did my scan exit 2 on a clean repository? Because exit 2 means the scan did not run, not that the code is bad. The usual causes are the Linux sandbox restriction, missing credentials, or an unwritable output directory [1].
Can I gate on medium findings? Yes, --fail-on-severity takes the level, and the documented example uses high [1]. Start higher than you think you need, because a gate that fails on style-adjacent findings gets disabled within a week.
high
Does it change anything in my repository? The scan and import paths do not; patch does, and that is a deliberate separate command with its own review. The GitHub collector is documented as reading alerts without changing GitHub [4].
What does the GitHub Action need? A GitHub-hosted Ubuntu 24.04 x64 runner on github.com or GitHub Enterprise Cloud, a key with access to the model, and a pinned distribution commit [2]. Self-hosted Linux runners need the sandbox setup first.
Is SARIF from both tools directly comparable? The envelope is the same standard and the details are not: Semgrep writes its rule id and severity, Codex Security writes its own findings model. Merge them for dashboards, but do not expect identical severity vocabularies across scanners.
[1] OpenAI, Codex Security CLI reference, fetched 2026-11-21. Source of the exit-code table, the --fail-on-severity behaviour, the SARIF path at <scan-dir>/exports/results.sarif, the rule that validation does not affect the gate, and the sandbox and output-directory failure conditions.
[2] OpenAI, Codex Security GitHub Action, fetched 2026-11-21. Source of the action inputs, the report-only default threshold, the estimated max-cost limit and its in-progress caveat, the Ubuntu 24.04 hosted-runner requirement, the Ubuntu sandbox setup section, the pinned-commit advice, and the read-only workflow permissions.
[3] OpenAI, importing external scanner findings, fetched 2026-11-21. Source of the three input paths, the publish findings preview flags, the import collectors, and the statement that imported evidence stays unassessed until it is stored.
publish findings
[4] OpenAI, Codex Security README, fetched 2026-11-21, referenced for the local preview and publication workflow, the connector list, and the read-only description of the GitHub collector.
[5] Semgrep, CLI reference and exit codes, fetched 2026-11-21, referenced for the documented exit-code section behind the codes I measured with Semgrep OSS 1.186.0.
[6] GitHub, uploading a SARIF file to GitHub, fetched 2026-11-21, referenced for the code scanning upload path that both tools' SARIF exports feed.
If you want this gate wired into your own pipeline with your existing scanners left in place, send a written intake and we will start from your runner and your rule sets. The same gate idea applied at the commit boundary instead of in CI is in the Code Mode hooks recipe, and the two posts that led here are the CLI walkthrough and what AI-written code costs to review.
Maxpertise is an AI-native engineering company. We embed native AI engineers inside your team, live in about 10 days. Please enable JavaScript to view the site, or email contact@maxpertise.net.