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): share published version history and remove duplicate checks (#1381)
mldangelo-oai4208ebef85f5
diff --git a/.github/workflows/container-release.yml b/.github/workflows/container-release.ymlindex 79376b97b..7f8a05e90 100644--- a/.github/workflows/container-release.yml+++ b/.github/workflows/container-release.yml@@ -216,10 +216,6 @@ jobs:shell: bashrun: |set -euo pipefail- if [[ ! "$IMAGE_DIGEST" =~ ^sha256:[[:xdigit:]]{64}$ ]]; then- echo 'The registry did not return a valid immutable platform digest.' >&2- exit 1- fimkdir -p "$RUNNER_TEMP/codex-security-platform-digests"touch "$RUNNER_TEMP/codex-security-platform-digests/${IMAGE_DIGEST#sha256:}"diff --git a/.github/workflows/node-github-release.yml b/.github/workflows/node-github-release.ymlindex ef50c193d..9cd3cb8b7 100644--- a/.github/workflows/node-github-release.yml+++ b/.github/workflows/node-github-release.yml@@ -173,11 +173,7 @@ jobs:sleep 2done- if [[ "$run_name" != "node-release" ||- "$run_status" != "completed" ||- "$run_conclusion" != "success" ||- "$run_sha" != "$release_sha" ||- "$run_tag" != "$release_tag" ]]; then+ if [[ "$run_conclusion" != "success" ]]; thenecho "The release run must successfully publish the exact tagged commit." >&2exit 1fidiff --git a/sdk/typescript/scripts/release-automation.mjs b/sdk/typescript/scripts/release-automation.mjsindex 7844c2098..5fedf5139 100644--- a/sdk/typescript/scripts/release-automation.mjs+++ b/sdk/typescript/scripts/release-automation.mjs@@ -444,60 +444,38 @@ export function releaseHistory(tag, history) {}const publishedVersions = new Set(- history.registryVersions.filter(+ [+ ...history.registryVersions,+ ...history.githubReleaseTags+ .filter((tag) => typeof tag === "string" && tag.startsWith("npm-v"))+ .map((tag) => tag.slice("npm-v".length)),+ ].filter((candidate) =>typeof candidate === "string" && stableVersion.test(candidate),),);- const publishedGitHubTags = new Set(- history.githubReleaseTags.filter(- (candidate) =>- typeof candidate === "string" &&- candidate.startsWith("npm-v") &&- stableVersion.test(candidate.slice("npm-v".length)),- ),- );-- let previousTag = null;- for (const candidate of history.reachableTags) {- if (- typeof candidate !== "string" ||- !candidate.startsWith("npm-v") ||- !stableVersion.test(candidate.slice("npm-v".length))- ) {- continue;- }- const candidateVersion = candidate.slice("npm-v".length);+ let previousVersion = null;+ for (const tag of history.reachableTags) {+ if (typeof tag !== "string" || !tag.startsWith("npm-v")) continue;+ const candidate = tag.slice("npm-v".length);if (- compareReleaseVersions(candidateVersion, version) >= 0 ||- (!publishedVersions.has(candidateVersion) &&- !publishedGitHubTags.has(candidate))+ stableVersion.test(candidate) &&+ publishedVersions.has(candidate) &&+ compareReleaseVersions(candidate, version) < 0 &&+ (previousVersion === null ||+ compareReleaseVersions(candidate, previousVersion) > 0)) {- continue;- }-- if (- previousTag === null ||- compareReleaseVersions(- candidateVersion,- previousTag.slice("npm-v".length),- ) > 0- ) {- previousTag = candidate;+ previousVersion = candidate;}}- const makeLatest =- Array.from(publishedVersions).every(+ return {+ previousTag: previousVersion === null ? null : "npm-v" + previousVersion,+ makeLatest: Array.from(publishedVersions).every((candidate) => compareReleaseVersions(version, candidate) >= 0,- ) &&- Array.from(publishedGitHubTags).every(- (candidate) =>- compareReleaseVersions(version, candidate.slice("npm-v".length)) >= 0,- );-- return { previousTag, makeLatest };+ ),+ };}export function verifyPublishedRelease(metadata, archive, expected) {diff --git a/sdk/typescript/tests-ts/release-automation.test.ts b/sdk/typescript/tests-ts/release-automation.test.tsindex 2ef48cfba..b524208c4 100644--- a/sdk/typescript/tests-ts/release-automation.test.ts+++ b/sdk/typescript/tests-ts/release-automation.test.ts@@ -875,7 +875,7 @@ describe("published GitHub and npm release history", () => {test("never marks a historical backfill as latest", () => {expect(releaseHistory("npm-v0.1.2", {- registryVersions: ["0.1.1", "0.1.2", "0.1.3"],+ registryVersions: ["0.1.1", "0.1.2"],githubReleaseTags: ["npm-v0.1.3"],reachableTags: ["npm-v0.1.1"],}),@@ -895,7 +895,7 @@ describe("published GitHub and npm release history", () => {test("starts notes from the newest actually published version", () => {expect(releaseHistory("npm-v0.1.4", {- registryVersions: ["0.1.1", "0.1.2", "0.1.4"],+ registryVersions: ["0.1.1", "0.1.4"],githubReleaseTags: ["npm-v0.1.2"],reachableTags: ["npm-v0.1.3", "npm-v0.1.2", "npm-v0.1.1"],}),