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
refactor(release): retire first-publish npm bootstrap (#2472)
Michael D'Angelof956b5792f49
diff --git a/.github/workflows/node-release-cut.yml b/.github/workflows/node-release-cut.ymlindex e045f2f08..532e3f57a 100644--- a/.github/workflows/node-release-cut.yml+++ b/.github/workflows/node-release-cut.yml@@ -94,11 +94,8 @@ jobs:--json \--registry=https://registry.npmjs.org/)"; then- published_versions="$(- printf '%s\n' "$published_versions" |- node sdk/typescript/scripts/release-automation.mjs \- initial-published-versions "$version"- )"+ echo "Unable to verify published npm release history." >&2+ exit 1fiif [[ "$GITHUB_EVENT_NAME" == "workflow_run" ]] &&diff --git a/.github/workflows/node-release.yml b/.github/workflows/node-release.ymlindex fd689ecce..835079d71 100644--- a/.github/workflows/node-release.yml+++ b/.github/workflows/node-release.yml@@ -112,11 +112,8 @@ jobs:if ! published_versions="$(sfw npm view @openai/codex-security versions --json)"; then- published_versions="$(- printf '%s\n' "$published_versions" |- node sdk/typescript/scripts/release-automation.mjs \- initial-published-versions "$version"- )"+ echo "Unable to verify published npm release history." >&2+ exit 1fimode="$(printf '%s\n' "$published_versions" |@@ -456,21 +453,8 @@ jobs:fiecho "Protected npm release tag matches the verified commit."- - name: Publish initial npm release- if: needs.verify.outputs.mode == 'publish' && github.ref_name == 'npm-v0.1.0'- env:- NODE_AUTH_TOKEN: ${{ secrets.NPM_FIRST_PUBLISH_TOKEN }}- shell: bash- run: |- set -euo pipefail- if [[ -z "${NODE_AUTH_TOKEN:-}" ]]; then- echo "Security Products must configure NPM_FIRST_PUBLISH_TOKEN in the protected npm environment before the initial release." >&2- exit 1- fi- npm publish ./dist/*.tgz --provenance --access public --tag latest-- name: Publish to npm using trusted publishing- if: needs.verify.outputs.mode == 'publish' && github.ref_name != 'npm-v0.1.0'+ if: needs.verify.outputs.mode == 'publish'run: npm publish ./dist/*.tgz --provenance --access public --tag latestdispatch-github-release:diff --git a/sdk/typescript/scripts/release-automation.mjs b/sdk/typescript/scripts/release-automation.mjsindex 97fbcaebd..b661e28b9 100644--- a/sdk/typescript/scripts/release-automation.mjs+++ b/sdk/typescript/scripts/release-automation.mjs@@ -198,19 +198,6 @@ export function requireReleaseIncrease(version, previousVersion) {return version;}-/**- * @param {string} version- * @param {unknown} registryError- * @returns {string[]}- */-export function initialPublishedVersions(version, registryError) {- releaseVersion({ name: packageName, version });- if (version !== "0.1.0" || registryError?.error?.code !== "E404") {- throw new Error("Unable to verify published npm release history.");- }- return [];-}-/*** @param {string} version* @param {unknown} publishedVersions@@ -887,14 +874,6 @@ function main() {return;}- if (command === "initial-published-versions" && process.argv.length === 4) {- const registryError = JSON.parse(readFileSync(0, "utf8"));- console.log(- JSON.stringify(initialPublishedVersions(process.argv[3], registryError)),- );- return;- }-if (command === "require-published-increase" && process.argv.length === 4) {const publishedVersions = JSON.parse(readFileSync(0, "utf8"));console.log(@@ -978,8 +957,6 @@ function main() {"Usage: release-automation.mjs version <package.json>, " +"release-tag <ref-type> <ref> <ref-name> <package.json>, " +"require-increase <version> <previous-version>, " +- "initial-published-versions <version> " +- "(npm registry error JSON from stdin), " +"require-published-increase <version> " +"(published npm versions JSON from stdin), " +"release-mode <version> (published npm versions JSON from stdin), " +diff --git a/sdk/typescript/tests-ts/release-automation.test.ts b/sdk/typescript/tests-ts/release-automation.test.tsindex 07fdc92d1..a654f6e03 100644--- a/sdk/typescript/tests-ts/release-automation.test.ts+++ b/sdk/typescript/tests-ts/release-automation.test.ts@@ -26,7 +26,6 @@ import {releaseTagVersion,compareReleaseVersions,requireReleaseIncrease,- initialPublishedVersions,publishedReleaseMode,requirePublishedReleaseIncrease,releaseHistory,@@ -954,27 +953,6 @@ describe("monotonic stable release versions", () => {expect(publishedReleaseMode("0.1.3", ["0.1.0", "0.1.2"])).toBe("publish");});- test("allows a missing npm package only for its initial stable release", () => {- expect(- initialPublishedVersions("0.1.0", { error: { code: "E404" } }),- ).toEqual([]);- });-- test.each([- { version: "0.1.1", registryError: { error: { code: "E404" } } },- { version: "0.1.0", registryError: { error: { code: "E403" } } },- { version: "0.1.0", registryError: { error: { code: "ETIMEDOUT" } } },- { version: "0.1.0", registryError: { error: null } },- { version: "0.1.0", registryError: null },- ])(- "rejects unverified npm history for $version and registry response $registryError",- ({ version, registryError }) => {- expect(() => initialPublishedVersions(version, registryError)).toThrow(- "Unable to verify published npm release history.",- );- },- );-test("identifies the current published version as recoverable", () => {expect(publishedReleaseMode("0.1.2", ["0.1.0", "0.1.2"])).toBe("recover");});@@ -2221,41 +2199,35 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")}workflow: "release cut",version: "0.1.0",errorCode: "E404",- status: 0,},{workflow: "protected publisher",version: "0.1.0",errorCode: "E404",- status: 0,},{workflow: "release cut",version: "0.1.1",errorCode: "E404",- status: 1,},{workflow: "protected publisher",version: "0.1.1",errorCode: "E404",- status: 1,},{workflow: "release cut",version: "0.1.0",errorCode: "ETIMEDOUT",- status: 1,},{workflow: "protected publisher",version: "0.1.0",errorCode: "E403",- status: 1,},])(- "handles $errorCode during $workflow npm-history validation for $version",- async ({ workflow, version, errorCode, status }) => {+ "stops the $workflow when npm history for $version fails with $errorCode",+ async ({ workflow, version, errorCode }) => {const cutting = workflow === "release cut";const script = workflowStepShell(cutting ? releaseCutWorkflow : protectedReleaseWorkflow,@@ -2302,12 +2274,10 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")}{ cwd: fileURLToPath(new URL("../../../", import.meta.url)) },);- expect(result.status).toBe(status);- if (status !== 0) {- expect(result.stderr).toContain(- "Unable to verify published npm release history.",- );- }+ expect(result.status).toBe(1);+ expect(result.stderr).toContain(+ "Unable to verify published npm release history.",+ );},);