Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

ci(release): share npm setup and verification (#2476)

Michael D'Angelo590e3909a0af
diff --git a/.github/actions/setup-release-npm/action.yml b/.github/actions/setup-release-npm/action.yml
new file mode 100644
index 000000000..fb4530d37
--- /dev/null
+++ b/.github/actions/setup-release-npm/action.yml
@@ -0,0 +1,26 @@
+name: Set up release npm
+description: Install and verify the pinned npm for release provenance.
+runs:
+ using: composite
+ steps:
+ - name: Set up Node.js
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
+ with:
+ node-version: "24.15.0"
+ registry-url: "https://registry.npmjs.org"
+ package-manager-cache: false
+
+ - name: Install provenance-capable npm
+ shell: bash
+ run: | # zizmor: ignore[github-env] -- The verified npm bin directory is fixed under RUNNER_TEMP.
+ set -euo pipefail
+ source .github/scripts/release-npm.sh
+ install_release_npm
+ printf '%s\n' "$release_npm_bin" >> "$GITHUB_PATH"
+
+ - name: Verify npm on PATH
+ shell: bash
+ run: |
+ set -euo pipefail
+ source .github/scripts/release-npm.sh
+ verify_release_npm "$(command -v npm)"
diff --git a/.github/workflows/node-github-release.yml b/.github/workflows/node-github-release.yml
index 20bdc51b3..80b6c75de 100644
--- a/.github/workflows/node-github-release.yml
+++ b/.github/workflows/node-github-release.yml
@@ -52,27 +52,8 @@ jobs:
persist-credentials: false
ref: ${{ github.sha }}
- - name: Set up Node.js
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
- with:
- node-version: "24.15.0"
- registry-url: "https://registry.npmjs.org"
- package-manager-cache: false
-
- - name: Install provenance-capable npm
- shell: bash
- run: |
- set -euo pipefail
- source .github/scripts/release-npm.sh
- install_release_npm
- printf '%s\n' "$release_npm_bin" >> "$GITHUB_PATH"
-
- - name: Verify npm on PATH
- shell: bash
- run: |
- set -euo pipefail
- source .github/scripts/release-npm.sh
- verify_release_npm "$(command -v npm)"
+ - name: Set up release npm
+ uses: ./.github/actions/setup-release-npm
- name: Resolve the successful protected release
id: release
diff --git a/.github/workflows/node-release.yml b/.github/workflows/node-release.yml
index 835079d71..246cc4e26 100644
--- a/.github/workflows/node-release.yml
+++ b/.github/workflows/node-release.yml
@@ -320,27 +320,8 @@ jobs:
fetch-depth: 1
persist-credentials: false
- - name: Set up Node.js
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
- with:
- node-version: "24.15.0"
- registry-url: "https://registry.npmjs.org"
- package-manager-cache: false
-
- - name: Install provenance-capable npm
- shell: bash
- run: |
- set -euo pipefail
- source .github/scripts/release-npm.sh
- install_release_npm
- printf '%s\n' "$release_npm_bin" >> "$GITHUB_PATH"
-
- - name: Verify npm on PATH
- shell: bash
- run: |
- set -euo pipefail
- source .github/scripts/release-npm.sh
- verify_release_npm "$(command -v npm)"
+ - name: Set up release npm
+ uses: ./.github/actions/setup-release-npm
- name: Download verified package
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
diff --git a/sdk/typescript/tests-ts/release-automation.test.ts b/sdk/typescript/tests-ts/release-automation.test.ts
index 1ea0ed029..04a6cd68e 100644
--- a/sdk/typescript/tests-ts/release-automation.test.ts
+++ b/sdk/typescript/tests-ts/release-automation.test.ts
@@ -1818,9 +1818,8 @@ describe("GitHub release workflow safeguards", () => {
},
);
- test("pins both supported-minimum verification and protected signing runtimes", () => {
+ test("pins the supported-minimum release verification runtime", () => {
expect(protectedReleaseWorkflow).toContain('node-version: "22.13.0"');
- expect(protectedReleaseWorkflow).toContain('node-version: "24.15.0"');
});
test("restricts release cuts to main and increasing stable versions", () => {
@@ -3841,18 +3840,31 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")}
});
test("cryptographically verifies the exact npm provenance bundle", () => {
- expect(githubReleaseWorkflow).toContain('node-version: "24.15.0"');
expect(githubReleaseWorkflow).toContain("npm audit signatures");
expect(githubReleaseWorkflow).toContain("--include-attestations");
expect(githubReleaseWorkflow).toContain("verify-recovered-provenance");
});
test("both release jobs require the npm installed through the Socket Firewall", async () => {
- const both = (name: string) => {
- const script = workflowStepShell(protectedReleaseWorkflow, name);
- expect(workflowStepShell(githubReleaseWorkflow, name)).toBe(script);
- return script;
+ const action = "./.github/actions/setup-release-npm";
+ for (const [workflow, job] of [
+ [protectedReleaseWorkflow, "publish"],
+ [githubReleaseWorkflow, "release"],
+ ] as const) {
+ const { jobs } = Bun.YAML.parse(workflow) as WorkflowContract;
+ expect(jobs[job]?.steps?.map((step) => step.uses)).toContain(action);
+ }
+ const manifest = new URL(`../../../${action}/action.yml`, import.meta.url);
+ const { runs } = Bun.YAML.parse(readFileSync(manifest, "utf8")) as {
+ runs: { steps: NonNullable<WorkflowContract["jobs"][string]["steps"]> };
};
+ const [node, install, verifyPath] = runs.steps;
+ expect(node?.uses).toMatch(/^actions\/setup-node@[a-f0-9]{40}$/);
+ expect(node?.with).toEqual({
+ "node-version": "24.15.0",
+ "registry-url": "https://registry.npmjs.org",
+ "package-manager-cache": false,
+ });
const result = await runShell(
`RUNNER_TEMP="$(cd "$RUNNER_TEMP" && pwd)"
GITHUB_PATH="$RUNNER_TEMP/path"
@@ -3862,10 +3874,10 @@ npm() {
printf '#!/bin/sh\\necho "\${TEST_NPM_VERSION:-11.12.1}"\\n' > "$3/node_modules/.bin/npm"
chmod +x "$3/node_modules/.bin/npm"
}
-${both("Install provenance-capable npm")}
+${install!.run}
export PATH="$(cat "$GITHUB_PATH"):$PATH"
verify() { "$BASH" <<'VERIFY'
-${both("Verify npm on PATH")}
+${verifyPath!.run}
VERIFY
}
verify && echo selected