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
test: Windows archive checks time out too early (#1639)
ianw-oaid78ca123a4ce
diff --git a/sdk/typescript/tests-ts/package-tar-listing.test.ts b/sdk/typescript/tests-ts/package-tar-listing.test.tsindex 11ba4ef2a..79f1ef9aa 100644--- a/sdk/typescript/tests-ts/package-tar-listing.test.ts+++ b/sdk/typescript/tests-ts/package-tar-listing.test.ts@@ -1,4 +1,4 @@-import { spawnSync } from "node:child_process";+import { execFile, spawnSync } from "node:child_process";import { createHash } from "node:crypto";import {chmodSync,@@ -14,6 +14,7 @@ import {import { tmpdir } from "node:os";import { delimiter, join } from "node:path";import { fileURLToPath } from "node:url";+import { promisify } from "node:util";import { brotliCompressSync, brotliDecompressSync, gzipSync } from "node:zlib";import { describe, expect, test } from "bun:test";import {@@ -34,6 +35,10 @@ const { assertTarListingSizes, regularTarListingLines } = (await import(const { packageDistFiles } = (await import(new URL("../scripts/package-dist-files.mjs", import.meta.url).href)) as { packageDistFiles: readonly string[] };+// Avoid Bun 1.3.14's stale Windows spawnSync timeout.+// https://github.com/oven-sh/bun/issues/33932+const execFileAsync = promisify(execFile);+const pluginContract = {externalOwnedExact: [".codex-plugin/plugin.json"],shippedExact: ["scripts/launch_codex_security_mcp"],@@ -513,7 +518,7 @@ describe("npm package tar listings", () => {"ordinary-pax-then-wrong-long-name","ordinary-pax-then-correct-long-name","ordinary-long-name-then-pax",- ])("validates archive assets as npm installs them: %s", (representation) => {+ ])("validates assets installed by npm: %s", async (representation) => {const root = mkdtempSync(join(tmpdir(), "codex-package-npm-sparse-"));try {const logo = readFileSync(@@ -619,15 +624,12 @@ describe("npm package tar listings", () => {);const nativeRoot = join(root, "native");mkdirSync(nativeRoot);- const extracted = spawnSync(+ const extracted = await execFileAsync("tar",["-xzf", archivePath, "-C", nativeRoot],{ encoding: "buffer", timeout: 30_000, windowsHide: true },);- expect({- status: extracted.status,- stderr: extracted.stderr.toString(),- }).toEqual({ status: 0, stderr: "" });+ expect(extracted.stderr.toString()).toBe("");// These incompatible packages do not promise a portable native asset path.if (!wrongLongName)expect(readFileSync(join(nativeRoot, path)).equals(logo)).toBe(true);@@ -719,7 +721,7 @@ describe("npm package tar listings", () => {"pax-full","pax-path","oldgnu-readme",- ])("validates the manifest npm installs: %s", (representation) => {+ ])("validates the manifest npm installs: %s", async (representation) => {const root = mkdtempSync(join(tmpdir(), "codex-package-npm-manifest-"));try {const path = "package/package.json";@@ -794,15 +796,16 @@ describe("npm package tar listings", () => {}const archivePath = join(root, "package.tgz");writeFileSync(archivePath, gzipSync(packageTar({ overrides })));- const extracted = spawnSync("tar", ["-xOzf", archivePath, path], {- encoding: "buffer",- timeout: 30_000,- windowsHide: true,- });- expect({- status: extracted.status,- stderr: extracted.stderr.toString(),- }).toEqual({ status: 0, stderr: "" });+ const extracted = await execFileAsync(+ "tar",+ ["-xOzf", archivePath, path],+ {+ encoding: "buffer",+ timeout: 30_000,+ windowsHide: true,+ },+ );+ expect(extracted.stderr.toString()).toBe("");expect(extracted.stdout.equals(manifest)).toBe(true);const environment: NodeJS.ProcessEnv = {...process.env,