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
chore(release): approve npm and scanner images together (#2143)
Michael D'Angelo12cbba751a6b
diff --git a/.github/scripts/release-progress.mjs b/.github/scripts/release-progress.mjsindex 76d30b492..d1e254cf3 100644--- a/.github/scripts/release-progress.mjs+++ b/.github/scripts/release-progress.mjs@@ -9,6 +9,23 @@ import { isMain } from "../../sdk/typescript/scripts/is-main.mjs";const marker = "<!-- codex-security-release-progress -->";const workflows = ["node-ci", "node-release", "node-github-release"];+const npmDeploymentJobs = {+ "Publish npm and container images": {+ stage: "Release approval and npm publication",+ prompt:+ "Approve the **npm** deployment to publish the npm package and its matching container images.",+ },+ "Verify existing npm release": {+ stage: "Existing npm release verification",+ prompt:+ "Approve the **npm** deployment to verify the existing npm package and its signed provenance.",+ },+ publish: {+ stage: "Protected npm publication",+ prompt:+ "Approve the protected **npm** deployment in the linked release run.",+ },+};function status(value) {if (!value) return "Not started";@@ -66,7 +83,14 @@ export function renderProgress(job.name.startsWith("native /") ||job.name.startsWith("release tests /"),);- const publisher = npmJobs.find((job) => job.name === "publish");+ const npmDeploymentJob = npmJobs.find((job) =>+ Object.hasOwn(npmDeploymentJobs, job.name),+ );+ const npmDeployment = npmDeploymentJobs[npmDeploymentJob?.name] ?? {+ stage: "npm deployment",+ prompt:+ "Open the linked release run to see what the waiting job will do before approving the **npm** deployment.",+ };const verified = jobStatus(verification, npm);const actionPublisher = githubJobs.find((job) => job.name === "publish matching Action",@@ -112,15 +136,15 @@ export function renderProgress(row("npm release status", status(npm), npm, !npm && Boolean(github)),row("Release verification",- verified === "Passed" && !publisher && !awaitingApproval+ verified === "Passed" && !npmDeploymentJob && !awaitingApproval? status(npm): verified,npm,!npm && Boolean(github),),row(- "Protected npm publication",- awaitingApproval ? "Waiting for npm approval" : status(publisher),+ npmDeployment.stage,+ awaitingApproval ? "Waiting for npm approval" : status(npmDeploymentJob),npm,!npm && Boolean(github),),@@ -186,7 +210,7 @@ export function renderProgress(),"",awaitingApproval- ? "Approve the protected **npm** deployment in the linked release run."+ ? npmDeployment.prompt: awaitingContainerApproval? "Approve the protected **container** deployment in the linked release run.": "Progress updates do not change publication approvals or verification requirements.",diff --git a/.github/scripts/test_release_progress.mjs b/.github/scripts/test_release_progress.mjsindex f3ff48b60..519fbb785 100644--- a/.github/scripts/test_release_progress.mjs+++ b/.github/scripts/test_release_progress.mjs@@ -413,6 +413,7 @@ test("tracks protected container approval and failed reusable workflow jobs", asf.deployments.set(3, [{ environment: { name: "container" } }]);await f.update(3);assert.match(f.body(), /Container image \| Waiting for container approval/u);+ assert.match(f.body(), /Approve the protected \*\*container\*\* deployment/u);await f.watch(3, async () => {f.deployments.set(3, []);Object.assign(f.runs.get(3), {@@ -448,17 +449,46 @@ test("keeps one comment across CI, verification, and protected approval", asyncassert.equal(f.comments.length, 1);assert.match(f.body(), /Post-merge CI \| Passed/u);assert.match(f.body(), /Release verification \| Passed/u);+ assert.match(f.body(), /npm deployment \| Waiting for npm approval/u);+ assert.match(f.body(), /see what the waiting job will do/u);+ f.jobs.get(2).push(job("Publish npm and container images", null));+ assert.equal((await f.update(2)).action, "updated");assert.match(f.body(),- /Protected npm publication \| Waiting for npm approval/u,+ /Release approval and npm publication \| Waiting for npm approval/u,+ );+ assert.match(+ f.body(),+ /publish the npm package and its matching container images/u,);assert.match(f.body(), /runs\/2/u);assert.deepEqual(f.writes().map((request) => request.method),- ["POST", "PATCH"],+ ["POST", "PATCH", "PATCH"],);assert.equal((await f.update(2)).action, "unchanged");- assert.equal(f.writes().length, 2);+ assert.equal(f.writes().length, 3);+});++test("tracks approval and completion of existing npm release verification", async () => {+ const f = fixture();+ f.runs.set(2, run(2, "node-release", { status: "waiting" }));+ f.jobs.set(2, [job("verify"), job("Verify existing npm release", null)]);+ f.deployments.set(2, [{ environment: { name: "npm" } }]);+ await f.update(2);+ assert.match(+ f.body(),+ /Existing npm release verification \| Waiting for npm approval/u,+ );+ assert.match(+ f.body(),+ /verify the existing npm package and its signed provenance/u,+ );+ f.deployments.set(2, []);+ f.jobs.set(2, [job("verify"), job("Verify existing npm release")]);+ await f.update(2);+ assert.match(f.body(), /Existing npm release verification \| Passed/u);+ assert.match(f.body(), /Container image \| Not started/u);});test("follows a release tagged on a successful fix back to its version-bump PR", async (t) => {@@ -499,7 +529,7 @@ test("follows a release tagged on a successful fix back to its version-bump PR",await f.update(1);assert.match(f.body(), /Post-merge CI \| Failed/u);f.runs.set(2, run(2, "node-release", { head_sha: fix, status: "waiting" }));- f.jobs.set(2, [job("verify")]);+ f.jobs.set(2, [job("verify"), job("publish", null)]);f.deployments.set(2, [{ environment: { name: "npm" } }]);assert.equal((await f.update(2)).action, "updated");assert.equal(f.comments.length, 1);@@ -508,6 +538,7 @@ test("follows a release tagged on a successful fix back to its version-bump PR",f.body(),/Protected npm publication \| Waiting for npm approval/u,);+ assert.match(f.body(), /Approve the protected \*\*npm\*\* deployment/u);Object.assign(f.runs.get(2), { status: "completed", conclusion: "success" });f.runs.set(3,@@ -564,7 +595,7 @@ test("continues a release backfill when saved workflow runs were deleted", asyncassert.match(f.body(), /Post-merge CI \| Not recorded/u);if (deleted.includes(2)) {assert.match(f.body(), /npm release status \| Not recorded/u);- assert.match(f.body(), /Protected npm publication \| Not recorded/u);+ assert.match(f.body(), /npm deployment \| Not recorded/u);}f.requests.length = 0;assert.equal((await f.update(4)).action, "unchanged");@@ -729,7 +760,7 @@ test("resolves GitHub publication to the release tag, including annotated tags",assert.match(f.body(), /## Automated release complete/u);assert.match(f.body(), /Post-merge CI \| Not recorded/u);assert.match(f.body(), /Release verification \| Not recorded/u);- assert.match(f.body(), /Protected npm publication \| Not recorded/u);+ assert.match(f.body(), /npm deployment \| Not recorded/u);assert.match(f.body(), /GitHub Action \| Passed/u);assert.ok(f.requests.some(diff --git a/.github/workflows/container-publish.yml b/.github/workflows/container-publish.ymlindex a08c75ee7..4df656052 100644--- a/.github/workflows/container-publish.yml+++ b/.github/workflows/container-publish.yml@@ -9,6 +9,12 @@ on:release-version:required: truetype: string+ combined-approval:+ required: true+ type: boolean+ refresh-wolfi-recipe:+ type: boolean+ default: falserelease-integrity:type: stringrelease-tarball-artifact:@@ -39,6 +45,7 @@ jobs:attestations: readoutputs:sha: ${{ inputs.release-sha }}+ recipe-sha: ${{ inputs.refresh-wolfi-recipe && github.sha || inputs.release-sha }}image: ${{ steps.release.outputs.image }}version: ${{ inputs.release-version }}wolfi: ${{ steps.release.outputs.wolfi }}@@ -235,14 +242,15 @@ jobs:attestations: readuses: ./.github/workflows/wolfi-build.ymlwith:+ recipe-sha: ${{ needs.source.outputs.recipe-sha }}release-sha: ${{ needs.source.outputs.sha }}release-version: ${{ needs.source.outputs.version }}release-integrity: ${{ inputs.release-integrity }}release-tarball-artifact: ${{ inputs.release-tarball-artifact }}runtime-lock-artifact: ${{ inputs.runtime-lock-artifact }}- authorize:- name: authorize-container-publication+ preflight:+ name: Verify container publication prerequisitesneeds: [source, debian, wolfi]if: >-!cancelled() && needs.source.result == 'success' &&@@ -250,20 +258,52 @@ jobs:(needs.wolfi.result == 'success' || needs.source.outputs.wolfi != 'true') &&(needs.source.outputs.complete != 'true' || (needs.source.outputs.wolfi == 'true' && needs.wolfi.outputs.existing != 'true'))runs-on: ubuntu-24.04- environment: container+ outputs:+ npm-approved: ${{ steps.preflight.outputs.npm-approved }}permissions:contents: readpackages: readsteps:- - name: Require a public registry before uploading either image+ - &require-public-registry+ name: Require a public registry before uploading either image+ shell: bashenv:GH_TOKEN: ${{ github.token }}run: gh api "orgs/${GITHUB_REPOSITORY_OWNER,,}/packages/container/codex-security" | jq -e '.visibility == "public"'+ - name: Check whether npm approval covers the image inputs+ id: preflight+ shell: bash+ env:+ COMBINED_APPROVAL: ${{ inputs.combined-approval }}+ PUBLISH_WOLFI: ${{ needs.source.outputs.wolfi == 'true' && needs.wolfi.outputs.existing != 'true' }}+ RECIPE_SHA: ${{ needs.source.outputs.recipe-sha }}+ RELEASE_SHA: ${{ needs.source.outputs.sha }}+ run: |+ if [[ $COMBINED_APPROVAL == true && ( $PUBLISH_WOLFI == false || $RECIPE_SHA == "$RELEASE_SHA" ) ]]; then+ echo 'npm-approved=true' >> "$GITHUB_OUTPUT"+ fi++ authorize:+ name: authorize-container-publication+ needs: preflight+ if: >-+ !cancelled() && needs.preflight.result == 'success' &&+ needs.preflight.outputs.npm-approved != 'true'+ runs-on: ubuntu-24.04+ environment: container+ permissions:+ packages: read+ steps:+ # A backfill can wait for review after the initial registry check.+ - *require-public-registrymanifest:name: publish-and-verify-multiarchitecture-candidate- needs: [source, debian, authorize]- if: ${{ !cancelled() && needs.authorize.result == 'success' && needs.debian.result == 'success' }}+ needs: [source, debian, preflight, authorize]+ if: >-+ !cancelled() && needs.preflight.result == 'success' &&+ (needs.preflight.outputs.npm-approved == 'true' || needs.authorize.result == 'success') &&+ needs.debian.result == 'success'runs-on: ubuntu-24.04timeout-minutes: 30permissions:@@ -341,9 +381,11 @@ jobs:--source-ref refs/heads/mainpublish-wolfi:- needs: [source, authorize, attest, wolfi]+ needs: [source, preflight, authorize, attest, wolfi]if: >-- !cancelled() && needs.authorize.result == 'success' && needs.wolfi.result == 'success' &&+ !cancelled() && needs.preflight.result == 'success' &&+ (needs.preflight.outputs.npm-approved == 'true' || needs.authorize.result == 'success') &&+ needs.wolfi.result == 'success' &&needs.wolfi.outputs.existing != 'true' && (needs.attest.result == 'success' || needs.source.outputs.existing-digest != '')permissions:contents: read@@ -360,9 +402,11 @@ jobs:promote:name: promote-verified-and-attested-release- needs: [source, authorize, debian, attest, wolfi, publish-wolfi]+ needs: [source, preflight, authorize, debian, attest, wolfi, publish-wolfi]if: >-- !cancelled() && needs.authorize.result == 'success' && needs.source.outputs.complete != 'true' &&+ !cancelled() && needs.preflight.result == 'success' &&+ (needs.preflight.outputs.npm-approved == 'true' || needs.authorize.result == 'success') &&+ needs.source.outputs.complete != 'true' &&(needs.attest.result == 'success' || needs.source.outputs.existing-digest != '') &&(needs.source.outputs.wolfi != 'true' || needs.wolfi.outputs.existing == 'true' || needs.publish-wolfi.result == 'success')runs-on: ubuntu-24.04diff --git a/.github/workflows/node-github-release.yml b/.github/workflows/node-github-release.ymlindex d6dd4dcb8..101c7c3a1 100644--- a/.github/workflows/node-github-release.yml+++ b/.github/workflows/node-github-release.yml@@ -12,6 +12,10 @@ on:description: Successful node-release run to use for backfillrequired: falsetype: string+ refresh-wolfi-recipe:+ description: Use the current main Wolfi recipe when building a missing image.+ type: boolean+ default: falsepermissions:contents: read@@ -34,6 +38,7 @@ jobs:version: ${{ steps.release.outputs.version }}sha: ${{ steps.release.outputs.sha }}integrity: ${{ steps.artifact.outputs.integrity }}+ combined-approval: ${{ steps.artifact.outputs.combined-approval }}has-action: ${{ steps.action.outputs.present }}has-container: ${{ steps.container.outputs.present }}has-wolfi: ${{ steps.container.outputs.wolfi }}@@ -147,11 +152,12 @@ jobs:for ((attempt = 1; attempt <= 30; attempt++)); dorun_fields="$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$release_run" \- --jq '[.name, .status, (.conclusion // "pending"), .head_sha, .head_branch] | @tsv'+ --jq '[.path, .event, .status, (.conclusion // "pending"), .head_sha, .head_branch] | @tsv')"- IFS=$'\t' read -r run_name run_status run_conclusion run_sha run_tag <<< "$run_fields"+ IFS=$'\t' read -r run_path run_event run_status run_conclusion run_sha run_tag <<< "$run_fields"- if [[ "$run_name" != "node-release" ||+ if [[ "${run_path%%@*}" != ".github/workflows/node-release.yml" ||+ ( "$run_event" != push && "$run_event" != workflow_dispatch ) ||"$run_sha" != "$release_sha" ||"$run_tag" != "$release_tag" ]]; thenecho "The release run must successfully publish the exact tagged commit." >&2@@ -292,12 +298,11 @@ jobs:echo "Verified npm provenance for the resolved release run."elserecovery_conclusion="$(- gh api \- "repos/$GITHUB_REPOSITORY/actions/runs/$RELEASE_RUN_ID/jobs?per_page=100" \- --paginate \- --jq '.jobs[] | select(.name == "publish") | .steps[] | select(.name == "Verify recovered npm release provenance") | .conclusion'+ gh api "repos/$GITHUB_REPOSITORY/actions/runs/$RELEASE_RUN_ID/jobs?per_page=100" --paginate \+ --jq '.jobs[] | select(.conclusion == "success" and (.name == "publish" or .name == "Verify existing npm release"))+ | .steps[] | select(.name == "Verify recovered npm release provenance") | .conclusion')"- if [[ "$recovery_conclusion" != "success" ]]; then+ if [[ "$recovery_conclusion" != success ]]; thenecho "Signed npm provenance must identify the resolved successful release run." >&2exit 1fi@@ -325,10 +330,10 @@ jobs:original_run_fields="$(gh api \"repos/$GITHUB_REPOSITORY/actions/runs/$original_run_id" \- --jq '[.name, .status, .head_sha, .head_branch] | @tsv'+ --jq '[.path, .status, .head_sha, .head_branch] | @tsv')"- IFS=$'\t' read -r original_name original_status original_sha original_tag <<< "$original_run_fields"- if [[ "$original_name" != "node-release" ||+ IFS=$'\t' read -r original_path original_status original_sha original_tag <<< "$original_run_fields"+ if [[ "${original_path%%@*}" != ".github/workflows/node-release.yml" ||"$original_status" != "completed" ||"$original_sha" != "$RELEASE_SHA" ||"$original_tag" != "$RELEASE_TAG" ]]; then@@ -353,6 +358,15 @@ jobs:printf 'archive=%s\n' "$archive" >> "$GITHUB_OUTPUT"printf 'integrity=%s\n' "$(jq -r '."dist.integrity" // .dist.integrity' <<< "$metadata")" >> "$GITHUB_OUTPUT"+ # Only the attempt identified by signed npm provenance can authorize+ # images. If its job record is unavailable, request container review.+ signing_attempt=$(jq -er '.runAttempt' <<< "$verified_provenance")+ if combined_publisher="$(+ gh api "repos/$GITHUB_REPOSITORY/actions/runs/$verified_run_id/attempts/$signing_attempt/jobs?per_page=100" --paginate \+ --jq '.jobs[] | select(.name == "Publish npm and container images") | .conclusion'+ )" && [[ "$combined_publisher" == success ]]; then+ echo 'combined-approval=true' >> "$GITHUB_OUTPUT"+ fi- name: Detect Action release sourceid: action@@ -743,6 +757,8 @@ jobs:id-token: writeuses: ./.github/workflows/container-publish.ymlwith:+ combined-approval: ${{ needs.release.outputs.combined-approval == 'true' }}+ refresh-wolfi-recipe: ${{ inputs.refresh-wolfi-recipe }}release-sha: ${{ needs.release.outputs.sha }}release-version: ${{ needs.release.outputs.version }}release-integrity: ${{ needs.release.outputs.integrity }}diff --git a/.github/workflows/node-release.yml b/.github/workflows/node-release.ymlindex 67ecd41ba..3331e6aeb 100644--- a/.github/workflows/node-release.yml+++ b/.github/workflows/node-release.yml@@ -303,7 +303,7 @@ jobs:publish:if: github.repository == 'openai/codex-security'- name: publish+ name: ${{ needs.verify.outputs.mode == 'recover' && 'Verify existing npm release' || 'Publish npm and container images' }}needs: [verify, test]runs-on: ubuntu-latestenvironment: npmdiff --git a/.github/workflows/wolfi-build.yml b/.github/workflows/wolfi-build.ymlindex 18883a9f8..6a484dc48 100644--- a/.github/workflows/wolfi-build.yml+++ b/.github/workflows/wolfi-build.yml@@ -5,6 +5,7 @@ on:inputs:release-version: {type: string, required: true}release-sha: {type: string}+ recipe-sha: {type: string}release-integrity: {type: string}release-tarball-artifact: {type: string}runtime-lock-artifact: {type: string}@@ -54,6 +55,7 @@ jobs:- &checkoutuses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:+ ref: ${{ inputs.recipe-sha || github.sha }}fetch-depth: 0persist-credentials: false- &setup-nodediff --git a/RELEASING.md b/RELEASING.mdindex f2856b2f3..f7731fa3f 100644--- a/RELEASING.md+++ b/RELEASING.md@@ -285,11 +285,13 @@ for that exact commit:1. `node-release-cut` verifies that the version increased, checks the reviewedsummary, and creates the exact `npm-vX.Y.Z` tag.-2. `node-release` installs the committed dependency graph, tests and packs the- package, publishes it to npm, and records npm provenance. Three TypeScript- test shards and the MCP tests run in parallel with package verification.- Every shard and package check must pass before the protected npm job can- publish the verified archive.+2. `node-release` installs the committed dependency graph and packs the+ package. Three TypeScript test shards and the MCP tests run in parallel+ with package verification.+ After every shard and package check passes, approve the **npm** deployment+ for **Publish npm and container images**. This authorizes the npm archive+ and the matching container images built from the tagged release. The job+ publishes the verified archive to npm with signed provenance.3. `node-github-release` verifies the public package, provenance, tag, andarchive before publishing the GitHub release. It prepends the reviewedsummary to GitHub's categorized notes.@@ -332,8 +334,8 @@ registry errors fail immediately.do not prepare a release by editing or committing files there.The merged release PR receives one progress comment covering post-merge CI,-release verification, protected npm approval, public-package provenance,-installation checks, Action publication, and container approval and publication.+release verification and approval, public-package provenance, installation+checks, and Action and container publication. It links to any pending deployment.The main CI completion handler requests the first update for a merged releasePR, including when CI fails. Subsequent updates link to the relevant workflowsand track each publication stage. Each automatic release dispatch starts@@ -362,7 +364,6 @@ The automated release is complete when npm and GitHub publication, exact-versioninstall checks, and applicable Action and container publication have succeeded.The final job summarizes each result and identifies Marketplace publication as aseparate step. A successful workflow does not confirm a Marketplace listing.-The protected npm publication gates and immutable `npm-vX.Y.Z` tag remain in place.The npm package and CLI GitHub release become public before the installation andAction and container checks finish. Use the final workflow result before@@ -370,14 +371,16 @@ announcing that the automated release is complete.For new scanner releases, `node-github-release` publishes the matching Actionbefore starting the Debian and Wolfi builders. The Action distribution records-the runtime dependency lock used by both images with the verified npm tarball. Review the native-build results for Debian (amd64 and arm64) and Wolfi (amd64), then approve one-`container` deployment for both. The coordinated release requires both public-version tags to pass verification.+the runtime dependency lock used by both images with the verified npm tarball.+Debian (amd64 and arm64) and Wolfi (amd64) use the tagged release recipes.+After the native builds pass, the coordinator publishes the tested images+under the release approval and verifies both public version tags.To recover a missing image, dispatch `node-github-release` on `main` with the-original `npm-vX.Y.Z` tag. Recovery follows the capabilities of the tagged-source. Releases from 0.5.0 with a Dockerfile but without coordinated Wolfi+original `npm-vX.Y.Z` tag. The default backfill uses the release recipes.+Publishing missing images for a historical npm-only approval, or using a+different Wolfi recipe commit on request, requires a `container` approval.+Releases from 0.5.0 with a Dockerfile but without coordinated Wolfibuilds require only Debian. Earlier releases or releases without a Dockerfileskip containers. For retry instructions and independent Wolfi OS revisions, see[Container releases](docker/README.md#publishing).@@ -462,6 +465,13 @@ Do not retarget a release tag or publish a second package under the sameversion. The workflows are designed to recover from partial publication whilekeeping the original tag and package identity.+When the package is already published, `node-release` requests **npm** approval+for **Verify existing npm release**. This job verifies the original archive+and its signed provenance. Container publication uses the approval from the+run attempt that signed the package. If that attempt has no record of a+combined approval, the coordinator requests **container** approval before+publishing missing images.+To retry GitHub publication, run `node-github-release` from `main` with theexisting `npm-vX.Y.Z` tag. Supply the successful `node-release` run ID whenautomatic lookup is not enough. The workflow verifies the npm artifact anddiff --git a/docker/README.md b/docker/README.mdindex 8e9a12095..a9241d51c 100644--- a/docker/README.md+++ b/docker/README.md@@ -80,8 +80,10 @@ Prepare the [universal native payload](../plugins/codex-security/native/README.m**Public**, and grant the repository **Write** under **Manage Actions access**.The workflow uses `GITHUB_TOKEN` and refuses missing, private, or unreadablepackages. Verify `docker pull` works after logging out of GHCR.-3. Protect the repository's `container` environment with required reviewers and- deployment rules for protected `main` and approved `container-v*` tags.+3. Configure the protected `npm` environment with release reviewers authorized+ for both npm and GHCR and limit it to `npm-v*` tags. For image backfills+ and standalone Wolfi OS updates, protect the `container` environment with+ required reviewers and deployment rules for `main` and approved `container-v*` tags.Allow the workflow's pinned actions, package writes, and OIDC attestations.Update branch-protection check names if they reference the old release jobs.@@ -93,14 +95,14 @@ and [package access settings](https://docs.github.com/en/packages/learn-github-pAfter verifying the published npm tarball and installation, `node-github-release`publishes the matching Action. Its immutable `action-vX.Y.Z` tag preserves theruntime lock for future backfills. The workflow passes the verified archive and-lock to `container-publish`. Debian builds on amd64 and arm64 using the-Dockerfile at the scanner release commit. Wolfi builds on amd64 using the-recipe at the protected `main` commit selected for the run. Review the build summaries, then-approve one deployment to the protected `container` environment for both-images. Publication uses the tested digests, verifies anonymous pulls, and-attests the images before promoting their version tags. Debian carries BuildKit-SBOMs and maximum-mode provenance. Wolfi carries build provenance and an SPDX-inventory of its OS packages, installed npm packages, and native components.+lock to `container-publish`. Debian builds on amd64 and arm64 and Wolfi builds+on amd64, both using recipes from the scanner release commit. Approving+**Publish npm and container images** in the `npm` environment authorizes both+images for that release. Publication uses the tested digests, verifies+anonymous pulls, and attests the images before promoting their version tags.+Debian carries BuildKit SBOMs and maximum-mode provenance. Wolfi carries build+provenance and an SPDX inventory of its OS packages, installed npm packages,+and native components.To backfill a release, dispatch `node-github-release` on protected `main` withthe original `npm-vX.Y.Z` tag. A manual `container-release` run on `main`@@ -109,10 +111,13 @@ requests the coordinated release for the current package version. Pushing aThe release source determines which images are required.Sources from 0.5.0 onward with a Dockerfile but predating coordinated Wolfibuilds use the original Debian release path. Earlier releases skip image-publication. On a backfill, Wolfi can use refreshed OS pins from protected-`main` with the original scanner tarball and runtime lock. If the original Wolfi-tag already passes the source, lock, and attestation checks, the workflow-reuses its digest.+publication. A default backfill uses the scanner release commit's recipes.+If the Wolfi build needs updated OS pins, dispatch `node-github-release` with+`refresh-wolfi-recipe=true` to use the recipe from protected `main` with the+original scanner tarball and runtime lock. Review and approve the `container`+deployment when publishing with a different recipe commit or recovering+images for a release whose approval covered only npm. A backfill that+verifies all existing tags finishes without a deployment approval.Promotion updates tags separately. If publication stops partway through, rerunthe failed jobs to reuse the retained artifacts. The publisher verifies existingdiff --git a/docker/wolfi/README.md b/docker/wolfi/README.mdindex 823212594..a007a443d 100644--- a/docker/wolfi/README.md+++ b/docker/wolfi/README.md@@ -69,11 +69,12 @@ does not include a model.## Publish the amd64 variantFor a scanner release, `container-publish` supplies the same verified npm tarball-and runtime lock used for Debian. The builder records the scanner commit from-`npm-vX.Y.Z` and the recipe commit from protected `main`. One protected-`container` approval covers both images after the native tests pass. The Wolfi publisher verifies an anonymous-pull and attests build provenance and the SPDX inventory before promoting-`ghcr.io/openai/codex-security:X.Y.Z-wolfi-amd64`.+and runtime lock used for Debian. The scanner and Wolfi recipe both come from+`npm-vX.Y.Z`. One `npm` deployment approval authorizes the package and both+container images. The Wolfi publisher verifies an anonymous pull and attests+build provenance and the SPDX inventory before promoting+`ghcr.io/openai/codex-security:X.Y.Z-wolfi-amd64`. To recover a missing image+using refreshed OS pins, follow the [container backfill instructions](../README.md#publishing).### Wolfi-only OS updatesdiff --git a/sdk/typescript/scripts/release-automation.mjs b/sdk/typescript/scripts/release-automation.mjsindex 39f6611ef..0c2785979 100644--- a/sdk/typescript/scripts/release-automation.mjs+++ b/sdk/typescript/scripts/release-automation.mjs@@ -9,7 +9,7 @@ import { assertExpectedGitHead } from "./package-provenance.mjs";* @typedef {{ version: string, gitHead: string }} PublishedRelease* @typedef {PublishedRelease & { repository: string }} RepositoryRelease* @typedef {RepositoryRelease & { runId: string }} WorkflowRelease- * @typedef {WorkflowRelease & { sha512: string }} ReleaseProvenance+ * @typedef {WorkflowRelease & { runAttempt: string, sha512: string }} ReleaseProvenance*/const packageName = "@openai/codex-security";@@ -466,13 +466,7 @@ function verifySigningCertificate(bundle, expected) {);}- const runPrefix = `${expected.repository}/actions/runs/${expected.runId}/attempts/`;- const certificateRun = extensions.get(21);- if (- typeof certificateRun !== "string" ||- !certificateRun.startsWith(runPrefix) ||- !/^[1-9][0-9]*$/u.test(certificateRun.slice(runPrefix.length))- ) {+ if (extensions.get(21) !== expected.invocation) {throw new Error("The Fulcio certificate must identify the exact release run.",);@@ -770,7 +764,7 @@ export function verifySignatureAudit(report, archive, expected) {repository,releaseRef,gitHead: expected.gitHead,- runId,+ invocation,});return {@@ -778,6 +772,7 @@ export function verifySignatureAudit(report, archive, expected) {gitHead: expected.gitHead,repository: expected.repository,runId,+ runAttempt: invocation.slice(invocationPrefix.length),sha512,};}diff --git a/sdk/typescript/tests-ts/container-ci-workflow.test.ts b/sdk/typescript/tests-ts/container-ci-workflow.test.tsindex 13972985f..7f878b6e0 100644--- a/sdk/typescript/tests-ts/container-ci-workflow.test.ts+++ b/sdk/typescript/tests-ts/container-ci-workflow.test.ts@@ -75,8 +75,8 @@ test("keeps container validation available to forks and publication upstream-onlexpect(release.jobs["source"]?.if).toBe("github.workflow_ref == 'openai/codex-security/.github/workflows/node-github-release.yml@refs/heads/main'",);- expect(release.jobs["authorize"]?.needs).toContain("source");- expect(release.jobs["manifest"]?.needs).toContain("authorize");+ expect(release.jobs["preflight"]?.needs).toContain("source");+ expect(release.jobs["manifest"]?.needs).toContain("preflight");});test("stages the verified scanner archive and retains its locked dependencies", () => {diff --git a/sdk/typescript/tests-ts/container-release-workflow.test.ts b/sdk/typescript/tests-ts/container-release-workflow.test.tsindex 977448f57..b363320c8 100644--- a/sdk/typescript/tests-ts/container-release-workflow.test.ts+++ b/sdk/typescript/tests-ts/container-release-workflow.test.ts@@ -18,6 +18,7 @@ type Job = {if?: string;environment?: string;permissions?: Record<string, string>;+ outputs?: Record<string, string>;with?: Record<string, string>;steps?: Step[];};@@ -187,12 +188,15 @@ test("requires both verified artifacts for a scanner release with the Wolfi buil}});-test("approves both tested container candidates in one deployment", () => {+test("publishes tested images after the combined npm approval or the backfill approval", () => {const container = parent.jobs["container"]!;expect(container.uses).toBe("./.github/workflows/container-publish.yml");expect(container.needs).toContain("action-verify");expect(container.needs).toContain("action");expect(container.with).toMatchObject({+ "combined-approval":+ "${{ needs.release.outputs.combined-approval == 'true' }}",+ "refresh-wolfi-recipe": "${{ inputs.refresh-wolfi-recipe }}","release-sha": "${{ needs.release.outputs.sha }}","release-version": "${{ needs.release.outputs.version }}","release-integrity": "${{ needs.release.outputs.integrity }}",@@ -208,10 +212,29 @@ test("approves both tested container candidates in one deployment", () => {(key) => release.jobs[key]!.environment === "container",),).toEqual(["authorize"]);+ const preflight = release.jobs["preflight"]!;+ expect(preflight.outputs?.["npm-approved"]).toBe(+ "${{ steps.preflight.outputs.npm-approved }}",+ );for (const candidate of ["debian", "wolfi"]) {- expect(release.jobs["authorize"]?.needs).toContain(candidate);+ expect(preflight.needs).toContain(candidate);+ }+ expect(release.jobs["authorize"]).toMatchObject({+ needs: "preflight",+ steps: [preflight.steps![0]],+ if: expect.stringContaining(+ "needs.preflight.outputs.npm-approved != 'true'",+ ),+ });+ for (const writer of ["manifest", "publish-wolfi", "promote"]) {+ const job = release.jobs[writer]!;+ expect(job.needs).toContain("preflight");+ expect(job.needs).toContain("authorize");+ expect(job.if).toContain("needs.preflight.result == 'success'");+ expect(job.if).toContain(+ "(needs.preflight.outputs.npm-approved == 'true' || needs.authorize.result == 'success')",+ );}- expect(release.jobs["manifest"]?.needs).toContain("authorize");const upload = release.jobs["manifest"]!.steps!.find(({ name }) =>name === "Upload the approved index and verify its anonymous digest",@@ -223,7 +246,6 @@ test("approves both tested container candidates in one deployment", () => {'"docker://$IMAGE@$DIGEST" "oci:$RUNNER_TEMP/public:scanner"',);- expect(release.jobs["publish-wolfi"]?.needs).toContain("authorize");expect(release.jobs["promote"]?.needs).toContain("attest");expect(release.jobs["promote"]?.needs).toContain("publish-wolfi");expect(release.concurrency).toEqual({@@ -232,6 +254,35 @@ test("approves both tested container candidates in one deployment", () => {});});+test.each([+ ["routine release", true, true, "release", true],+ ["npm-only historical release", false, true, "release", false],+ ["new image from a refreshed recipe", true, true, "main", false],+ ["reusing an existing Wolfi image", true, false, "main", true],+] as const)(+ "checks the approval scope for %s",+ (_, combined, publishWolfi, recipe, approved) => {+ const directory = directories.create("approval");+ const output = join(directory, "output");+ writeFileSync(output, "");+ const preflight = release.jobs["preflight"]!.steps!.find(+ (step) =>+ step.name === "Check whether npm approval covers the image inputs",+ )!;+ const result = runWorkflowScript(directory, preflight.run, {+ GITHUB_OUTPUT: output.replaceAll("\\", "/"),+ COMBINED_APPROVAL: String(combined),+ PUBLISH_WOLFI: String(publishWolfi),+ RELEASE_SHA: "release",+ RECIPE_SHA: recipe,+ });+ expect(result.status, result.stderr).toBe(0);+ expect(readFileSync(output, "utf8")).toBe(+ approved ? "npm-approved=true\n" : "",+ );+ },+);+test("routes a Wolfi-only OS update through its own approval", () => {const publisher = workflow("publish-wolfi");const update = publisher.jobs["os-update"]!;@@ -266,6 +317,12 @@ test("passes the same verified npm tarball and runtime lock to both image builde}expect(debian.with?.["ref"]).toBe("${{ needs.source.outputs.sha }}");expect(wolfi.with?.["release-sha"]).toBe("${{ needs.source.outputs.sha }}");+ expect(wolfi.with?.["recipe-sha"]).toBe(+ "${{ needs.source.outputs.recipe-sha }}",+ );+ expect(release.jobs["source"]?.outputs?.["recipe-sha"]).toBe(+ "${{ inputs.refresh-wolfi-recipe && github.sha || inputs.release-sha }}",+ );});test("keeps historical native payloads tied to the release checkout", () => {@@ -643,3 +700,16 @@ test("refuses to replace a source tag pointing at another index", () => {expect(result.status).not.toBe(0);expect(result.output).not.toContain("digest=");});++test("checks out the selected Wolfi recipe while verifying the coordinator as signer", () => {+ const build = workflow("wolfi-build").jobs["build"]!;+ expect(build.steps![0]?.with?.["ref"]).toBe(+ "${{ inputs.recipe-sha || github.sha }}",+ );+ const publisher = workflow("publish-wolfi");+ expect(publisher.jobs["os-update"]!.with).not.toHaveProperty("recipe-sha");+ const promote = publisher.jobs["publish"]!.steps!.find(+ ({ name }) => name === "Promote only the verified Wolfi tag",+ );+ expect(promote?.run).toContain('--source-digest "$GITHUB_SHA"');+});diff --git a/sdk/typescript/tests-ts/release-automation.test.ts b/sdk/typescript/tests-ts/release-automation.test.tsindex 3f80f9292..338c18246 100644--- a/sdk/typescript/tests-ts/release-automation.test.ts+++ b/sdk/typescript/tests-ts/release-automation.test.ts@@ -45,6 +45,8 @@ const automationScript = new URL(const releaseCommit = "1e03c89ad22d2df5ae65b146be1483b3608572a9";const releaseRun = "30481596229";const releaseRepository = "openai/codex-security";+const combinedPublisher = "Publish npm and container images";+const recoveryPublisher = "Verify existing npm release";const releaseWorkflowTimeout = process.platform === "win32" ? 20_000 : 10_000;const directories = createTemporaryDirectoriesSync();@@ -494,6 +496,7 @@ type WorkflowContract = {jobs: Record<string,{+ name?: string;permissions?: Record<string, string>;env?: Record<string, string>;needs?: string | string[];@@ -565,10 +568,10 @@ gh() {printf '%s\n' "$MOCK_BRANCH_SHA";;"repos/test/codex-security/actions/runs/$INPUT_RUN_ID")- [[ "$4" == '[.name, .status, (.conclusion // "pending"), .head_sha, .head_branch] | @tsv' ]] || return 65+ [[ "$4" == '[.path, .event, .status, (.conclusion // "pending"), .head_sha, .head_branch] | @tsv' ]] || return 65local conclusion=pendingif [[ "$MOCK_RUN_STATUS" == completed ]]; then conclusion=success; fi- printf '%s\t%s\t%s\t%s\t%s\n' node-release "$MOCK_RUN_STATUS" "$conclusion" "$MOCK_RUN_SHA" npm-v0.1.2+ printf '%s\t%s\t%s\t%s\t%s\t%s\n' "$MOCK_WORKFLOW_PATH" "$MOCK_RUN_EVENT" "$MOCK_RUN_STATUS" "$conclusion" "$MOCK_RUN_SHA" npm-v0.1.2;;*) return 65 ;;esac@@ -582,9 +585,12 @@ ${script}`,MOCK_TAG_TYPE: "commit",MOCK_TAG_OBJECT: releaseCommit,MOCK_RUN_STATUS: "completed",+ MOCK_RUN_EVENT: "workflow_dispatch",MOCK_NEXT_STATUS: "completed",MOCK_SLEEP_LOG: "",MOCK_RUN_SHA: releaseCommit,+ MOCK_WORKFLOW_PATH:+ ".github/workflows/node-release.yml@refs/tags/npm-v0.1.2",MOCK_BRANCH_SHA: releaseCommit,MOCK_GH_LOG: "/dev/null",...env,@@ -1213,6 +1219,7 @@ describe("GitHub release publication verification", () => {};const provenance = {...expected,+ runAttempt: "1",sha512,};@@ -1316,6 +1323,7 @@ describe("cryptographically verified npm provenance", () => {gitHead: releaseCommit,repository: releaseRepository,runId: releaseRun,+ runAttempt: "1",sha512,});});@@ -1332,6 +1340,7 @@ describe("cryptographically verified npm provenance", () => {gitHead: releaseCommit,repository: releaseRepository,runId: releaseRun,+ runAttempt: "1",sha512,});});@@ -1368,6 +1377,24 @@ describe("cryptographically verified npm provenance", () => {).toThrow("The Fulcio certificate must identify the exact release run.");});+ test("rejects an invocation for a different attempt of the signing run", () => {+ expect(() => verifySignatureFixture({ attempt: "2" })).toThrow(+ "The Fulcio certificate must identify the exact release run.",+ );+ });++ test("returns the attempt number authenticated by the statement and certificate", () => {+ expect(+ verifySignatureFixture({+ attempt: "3",+ signingCertificate: signingCertificateWithReplacement(+ "/attempts/1",+ "/attempts/3",+ ),+ }).runAttempt,+ ).toBe("3");+ });+test("rejects a recovered archive signed for a different source commit", () => {expect(() =>verifyRecoveredSignatureAudit(signatureAudit(), archive, {@@ -1398,6 +1425,7 @@ describe("cryptographically verified npm provenance", () => {gitHead: releaseCommit,repository: releaseRepository,runId: releaseRun,+ runAttempt: "1",sha512,});});@@ -2673,6 +2701,9 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")}expect(jobs["test"]?.permissions).toEqual({ contents: "read" });expect(jobs["test"]?.env).toEqual(jobs["verify"]?.env);expect(jobs["publish"]?.needs).toEqual(["verify", "test"]);+ expect(jobs["publish"]?.name).toBe(+ `\${{ needs.verify.outputs.mode == 'recover' && '${recoveryPublisher}' || '${combinedPublisher}' }}`,+ );expect(jobs["publish"]?.environment).toBe("npm");expect(jobs["publish"]?.permissions).toEqual({contents: "read",@@ -2974,6 +3005,28 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")});});+ test("rejects a different workflow presenting the release tag and commit", async () => {+ const result = await resolveProtectedRelease({+ MOCK_WORKFLOW_PATH: ".github/workflows/other.yml",+ });+ expect(result.status).toBe(1);+ expect(result.stderr).toContain(+ "The release run must successfully publish the exact tagged commit.",+ );+ });++ test.each([+ ["push", 0],+ ["workflow_dispatch", 0],+ ["pull_request", 1],+ ] as const)(+ "checks the %s event for the selected npm run",+ async (event, status) => {+ const result = await resolveProtectedRelease({ MOCK_RUN_EVENT: event });+ expect(result.status).toBe(status);+ },+ );+test("times out safely if a protected npm release never completes", async () => {const sleeps = join(directories.create("release-timeout-"), "sleeps");const result = await resolveProtectedRelease({@@ -3249,7 +3302,29 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")}test.each([{- description: "the exact successful publishing run",+ description:+ "a successful signing attempt carried into a failed-jobs-only rerun",+ exact: true,+ resolvedPublisher: combinedPublisher,+ originalCombined: true,+ combined: true,+ recoveryConclusion: "skipped",+ status: 0,+ message: "Verified npm provenance for the resolved release run.",+ },+ {+ description:+ "a failed signing attempt followed by a successful recovery in the same run",+ exact: true,+ resolvedPublisher: recoveryPublisher,+ originalCombined: true,+ originalConclusion: "failure",+ recoveryConclusion: "success",+ status: 0,+ message: "Verified npm provenance for the resolved release run.",+ },+ {+ description: "the historical npm-only publisher",exact: true,recoveryConclusion: "skipped",status: 0,@@ -3263,7 +3338,44 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")}"Signed npm provenance must identify the resolved successful release run.",},{- description: "the authenticated original signing run after recovery",+ description: "a combined signing run recovered by an npm-only job",+ originalCombined: true,+ latestOriginalConclusion: "failure",+ combined: true,+ recoveryConclusion: "success",+ status: 0,+ message:+ "Verified protected recovery provenance from its original signing run.",+ },+ {+ description:+ "an npm-only signing run verified by the current recovery job",+ resolvedPublisher: recoveryPublisher,+ recoveryConclusion: "success",+ status: 0,+ message:+ "Verified protected recovery provenance from its original signing run.",+ },+ {+ description: "a recovery run impersonating the combined publisher",+ resolvedPublisher: combinedPublisher,+ recoveryConclusion: "success",+ status: 1,+ message:+ "Signed npm provenance must identify the resolved successful release run.",+ },+ {+ description: "an exact historical signing run whose jobs are unavailable",+ exact: true,+ jobsUnavailable: true,+ recoveryConclusion: "skipped",+ status: 0,+ message: "Verified npm provenance for the resolved release run.",+ },+ {+ description: "a package signed before its combined publisher failed",+ originalCombined: true,+ originalConclusion: "failure",recoveryConclusion: "success",status: 0,message:@@ -3280,7 +3392,13 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")}])("binds GitHub release provenance to $description",async ({+ combined = false,exact = false,+ jobsUnavailable = false,+ resolvedPublisher = "publish",+ originalCombined = false,+ originalConclusion = "success",+ latestOriginalConclusion = originalConclusion,recoveryConclusion,originalCommit = releaseCommit,status,@@ -3295,8 +3413,29 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")});mkdirSync(join(workspace, "dist"));writeFileSync(join(workspace, "dist", "release.tgz"), "verified archive");+ const signingRun = exact ? releaseRun : "30481596228";+ function jobsPayload(name: string, conclusion: string, recovery: string) {+ return JSON.stringify({+ jobs: [+ {+ name,+ conclusion,+ steps: [+ {+ name: "Verify recovered npm release provenance",+ conclusion: recovery,+ },+ ],+ },+ ],+ });+ }const mocks = [+ // Native Windows jq otherwise writes CRLF to the workflow's Bash substitutions.+ process.platform === "win32"+ ? 'jq() { command jq --binary "$@"; }'+ : "","npm() {",' case "$1" in'," view) printf '%s\\n' '{}' ;;",@@ -3318,10 +3457,10 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")}' if [[ "$MOCK_EXACT_PROVENANCE" != "1" || "$7" != "$RELEASE_RUN_ID" ]]; then'," return 68"," fi",- ' printf \'{"runId":"%s"}\\n\' "$RELEASE_RUN_ID"',+ ' printf \'{"runId":"%s","runAttempt":"3"}\\n\' "$RELEASE_RUN_ID"'," ;;"," verify-recovered-provenance)",- ' printf \'{"runId":"%s"}\\n\' "$MOCK_ORIGINAL_RUN_ID"',+ ' printf \'{"runId":"%s","runAttempt":"3"}\\n\' "$MOCK_ORIGINAL_RUN_ID"'," ;;"," *) return 66 ;;"," esac",@@ -3334,10 +3473,17 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")}" shift",' case "$1" in',` "repos/test/codex-security/actions/runs/${releaseRun}/jobs?per_page=100")`,- " printf '%s\\n' \"$MOCK_RECOVERY_CONCLUSION\"",+ ' jq -r "${!#}" <<< "$MOCK_RESOLVED_JOBS"',+ " ;;",+ ' "repos/test/codex-security/actions/runs/30481596228/jobs?per_page=100")',+ ' jq -r "${!#}" <<< "$MOCK_ORIGINAL_LATEST_JOBS"',+ " ;;",+ ` "repos/test/codex-security/actions/runs/${signingRun}/attempts/3/jobs?per_page=100")`,+ ' if [[ "$MOCK_JOBS_UNAVAILABLE" == true ]]; then return 68; fi',+ ' jq -r "${!#}" <<< "$MOCK_SIGNING_JOBS"'," ;;",' "repos/test/codex-security/actions/runs/30481596228")',- " printf '%s\\t%s\\t%s\\t%s\\n' node-release completed \"$MOCK_ORIGINAL_COMMIT\" npm-v0.1.2",+ " printf '%s\\t%s\\t%s\\t%s\\n' .github/workflows/node-release.yml completed \"$MOCK_ORIGINAL_COMMIT\" npm-v0.1.2"," ;;"," *) return 67 ;;"," esac",@@ -3346,12 +3492,27 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")}const result = await runShell(`${mocks}\n${script}`,{- GITHUB_OUTPUT: "/dev/null",+ GITHUB_OUTPUT: "outputs",GITHUB_REPOSITORY: "test/codex-security",MOCK_EXACT_PROVENANCE: exact ? "1" : "0",MOCK_ORIGINAL_COMMIT: originalCommit,MOCK_ORIGINAL_RUN_ID: "30481596228",- MOCK_RECOVERY_CONCLUSION: recoveryConclusion,+ MOCK_JOBS_UNAVAILABLE: String(jobsUnavailable),+ MOCK_RESOLVED_JOBS: jobsPayload(+ resolvedPublisher,+ "success",+ recoveryConclusion,+ ),+ MOCK_ORIGINAL_LATEST_JOBS: jobsPayload(+ originalCombined ? combinedPublisher : "publish",+ latestOriginalConclusion,+ "skipped",+ ),+ MOCK_SIGNING_JOBS: jobsPayload(+ originalCombined ? combinedPublisher : "publish",+ originalConclusion,+ "skipped",+ ),RELEASE_RUN_ID: releaseRun,RELEASE_SHA: releaseCommit,RELEASE_TAG: "npm-v0.1.2",@@ -3363,6 +3524,11 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")}expect(result.status).toBe(status);if (status === 0) {expect(result.stdout).toContain(message);+ expect(+ readFileSync(join(workspace, "outputs"), "utf8").includes(+ "combined-approval=true",+ ),+ ).toBe(combined);} else {expect(result.stderr).toContain(message);}