OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security
TypeScript ai-securityapplication-securityclicode-scanningcodexcodex-securitycybersecuritydevsecopsnodejsnpmopenaisdksecuritytypescriptvulnerability-scanning
fix(ci): pin Codex Security smoke test API endpoint (#1293)
mldangelo-oaif230f7621d47
diff --git a/.github/workflows/invoice-desk-scan.yml b/.github/workflows/invoice-desk-scan.ymlindex 3196bf34a..29241af44 100644--- a/.github/workflows/invoice-desk-scan.yml+++ b/.github/workflows/invoice-desk-scan.yml@@ -92,7 +92,7 @@ jobs:fail-fast: falsematrix:target: ${{ fromJSON(needs.target.outputs.targets) }}- environment: invoice-desk-inference+ environment: codex-security-smoke-testruns-on: ubuntu-24.04timeout-minutes: 60cache-mode: read@@ -164,7 +164,7 @@ jobs:CODEX_SECURITY_STATE_DIR: ${{ runner.temp }}/invoice-desk-staterun: |if [[ -z "$OPENAI_API_KEY" ]]; then- echo "::error::Configure OPENAI_API_KEY in the protected invoice-desk-inference environment."+ echo "::error::Configure OPENAI_API_KEY in the protected codex-security-smoke-test environment."echo "exit-code=2" >> "$GITHUB_OUTPUT"echo "elapsed-seconds=0" >> "$GITHUB_OUTPUT"exit 2@@ -173,6 +173,7 @@ jobs:scan_status=0"$RUNNER_TEMP/codex-security-cli/node_modules/.bin/codex-security" scan . \--provider openai --auth api-key \+ --codex 'openai_base_url="https://us.api.openai.com/v1"' \--model gpt-5.6-sol --effort high --mode standard \--headless --format json \--output-dir "$RUNNER_TEMP/invoice-desk-scan" \diff --git a/examples/github-actions/README.md b/examples/github-actions/README.mdindex 9a7528650..6040f6f81 100644--- a/examples/github-actions/README.md+++ b/examples/github-actions/README.md@@ -97,12 +97,13 @@ you are authorized to submit to the configured inference provider.The repository's [Invoice Desk workflow](../../.github/workflows/invoice-desk.yml)adapts this example to `--provider openai --auth api-key` using an-`OPENAI_API_KEY` secret in a protected GitHub environment. Pull requests to-`main` run behavior tests without inference credentials. A trusted dispatcher+`OPENAI_API_KEY` secret in the protected `codex-security-smoke-test` GitHub+environment. Pull requests to `main` run behavior tests without inference+credentials. A trusted dispatcherhandles only PR metadata and starts a separate[scan workflow](../../.github/workflows/invoice-desk-scan.yml) on protected `main`.-It scans each PR's application source, including forks and drafts, after-environment approval. The Actions summary shows the PR number, source commit,+It scans each PR's application source, including forks and drafts, unattended.+The Actions summary shows the PR number, source commit,finding counts, coverage, elapsed time, and package-cache reuse. Reports, metricsJSON, and SARIF are saved as artifacts.Only public CLI package downloads are cached; analysis and authentication statediff --git a/examples/invoice-desk/README.md b/examples/invoice-desk/README.mdindex 9d68a68c0..1d7fc492c 100644--- a/examples/invoice-desk/README.md+++ b/examples/invoice-desk/README.md@@ -58,7 +58,7 @@ without a manual approval step. Failed behavior tests do not suppress a scan.### SetupBoth workflows must be on `main` before automatic scans can run. Configure the-`invoice-desk-inference` environment without required reviewers or a wait timer,+`codex-security-smoke-test` environment without required reviewers or a wait timer,and with a deployment branch rule allowing only protected `main`. Store adedicated service-account key in its `OPENAI_API_KEY` environment secret, withaccess to `gpt-5.6-sol` and permission to use the API from the selected runner's@@ -66,6 +66,12 @@ network. Creating a service account alone does not grant that network access.Do not use a repository or organization Actions secret for this workflow. Amissing key fails the scan with a setup error.+The scan uses `https://us.api.openai.com/v1` through Codex's existing+`openai_base_url` setting. The endpoint is fixed in the workflow on protected+`main`, so Actions variables and inherited `OPENAI_BASE_URL` values cannot+redirect the credential. Use a service account whose project supports this US+endpoint.+The workflow on protected `main` selects and extracts the exact PR source beforeinference. Behavior tests receive no inference credentials; GitHub may separatelyrequire approval to run them for a first-time contributor. Adding requireddiff --git a/sdk/typescript/tests-ts/invoice-desk-workflow.test.ts b/sdk/typescript/tests-ts/invoice-desk-workflow.test.tsindex 038e0c945..2f6c75c48 100644--- a/sdk/typescript/tests-ts/invoice-desk-workflow.test.ts+++ b/sdk/typescript/tests-ts/invoice-desk-workflow.test.ts@@ -137,6 +137,8 @@ for (const status of [0, 1, 2]) {"openai","--auth","api-key",+ "--codex",+ 'openai_base_url="https://us.api.openai.com/v1"',"--model","gpt-5.6-sol","--effort",@@ -160,6 +162,18 @@ for (const status of [0, 1, 2]) {});}+test("Invoice Desk keeps the trusted API endpoint despite an inherited override", () => {+ const directory = fixture();+ const result = runStep(scan, directory, {+ OPENAI_BASE_URL: "https://untrusted.example/v1",+ });+ expect(result.status).toBe(0);+ const arguments_ = argumentsFor(directory);+ expect(arguments_[arguments_.indexOf("--codex") + 1]).toBe(+ 'openai_base_url="https://us.api.openai.com/v1"',+ );+});+test("Invoice Desk reports a missing key without invoking the scanner", () => {const directory = fixture();const result = runStep(scan, directory, { OPENAI_API_KEY: "" });