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(package): explain the Alpine tar prerequisite in release checks (#2536)
Michael D'Angelo0e606bf1bc92
diff --git a/sdk/typescript/TESTING.md b/sdk/typescript/TESTING.mdindex 310e6fc33..c5345e032 100644--- a/sdk/typescript/TESTING.md+++ b/sdk/typescript/TESTING.md@@ -59,6 +59,8 @@ pnpm run test:packageReplace `X.Y.Z` with the version in the filename printed by `pnpm pack`.Packing regenerates SDK defaults and project schemas before building the MCP runtime.+On Alpine Linux, install GNU tar with `apk add tar` before running `check:package`.+The BusyBox tar applet lacks the archive options used by the release checker.The authored plugin lives in `plugins/codex-security`. `pnpm pack` generatesthe ignored `_bundled_plugin` runtime payload from `plugins/codex-security/plugin-files.json` duringdiff --git a/sdk/typescript/scripts/check-package.mjs b/sdk/typescript/scripts/check-package.mjsindex 6fc6c4125..5a5bb3de2 100644--- a/sdk/typescript/scripts/check-package.mjs+++ b/sdk/typescript/scripts/check-package.mjs@@ -77,9 +77,19 @@ function tar(args, encoding = "buffer") {...tarOptions,encoding,});+ const stderr = result.stderr?.toString().trim() ?? "";+ if (+ result.status !== 0 &&+ stderr.startsWith("tar: unrecognized option: ignore-zeros\nBusyBox ")+ ) {+ // BusyBox can exit before Node finishes writing a larger archive to stdin.+ throw new Error(+ `Package validation requires tar with --ignore-zeros. On Alpine Linux, install GNU tar with 'apk add tar'.\n${stderr}`,+ { cause: result.error },+ );+ }if (result.error !== undefined) throw result.error;if (result.status !== 0 || result.stderr.length !== 0) {- const stderr = result.stderr.toString().trim();throw new Error(`npm tarball contains an invalid tar entry${stderr === "" ? "." : `: ${stderr}`}`,);diff --git a/sdk/typescript/tests-ts/package-tar-listing.test.ts b/sdk/typescript/tests-ts/package-tar-listing.test.tsindex 80badc42f..fb255c431 100644--- a/sdk/typescript/tests-ts/package-tar-listing.test.ts+++ b/sdk/typescript/tests-ts/package-tar-listing.test.ts@@ -929,6 +929,37 @@ describe("npm package tar listings", () => {},);+ test.skipIf(process.platform === "win32")(+ "explains the missing tar option on Alpine",+ async () => {+ const root = mkdtempSync(join(tmpdir(), "codex-package-tar-option-"));+ try {+ const tools = join(root, "tools");+ mkdirSync(tools);+ writeFileSync(+ join(tools, "tar"),+ "#!/bin/sh\necho 'tar: unrecognized option: ignore-zeros' >&2\necho 'BusyBox multi-call binary.' >&2\nexit 1\n",+ { mode: 0o755 },+ );+ const path = join(root, "package.tgz");+ writeFileSync(path, gzipSync(packageTar(), { level: 0 }));+ const contract = join(root, "contract.json");+ writeFileSync(contract, JSON.stringify(pluginContract));+ const checked = await checkPackage(root, path, contract, {+ ...process.env,+ PATH: tools + delimiter + process.env["PATH"],+ });+ expect(checked.status).toBe(1);+ expect(checked.stderr).toContain("apk add tar");+ expect(checked.stderr).toContain(+ "tar: unrecognized option: ignore-zeros",+ );+ } finally {+ rmSync(root, { force: true, recursive: true });+ }+ },+ );+test("streams each archive without resolving tar from its directory", async () => {const root = mkdtempSync(join(tmpdir(), "codex-package-tar-test-"));try {