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

test(release): share shell setup and verification fixtures (#1379)

mldangelo-oai03dfabfa24ba
diff --git a/sdk/typescript/tests-ts/release-automation.test.ts b/sdk/typescript/tests-ts/release-automation.test.ts
index 625043e6b..2ef48cfba 100644
--- a/sdk/typescript/tests-ts/release-automation.test.ts
+++ b/sdk/typescript/tests-ts/release-automation.test.ts
@@ -159,6 +159,14 @@ const releaseWorkflowTimeout = process.platform === "win32" ? 20_000 : 10_000;
const bash = bashCommand();
+function runShell(script: string, env: NodeJS.ProcessEnv, cwd?: string) {
+ return runCommand(bash, ["-c", script], {
+ cwd,
+ env: { ...process.env, ...env },
+ timeout: 10_000,
+ });
+}
+
const jqMock = [
"jq() {",
' node -e \'const fs=require("node:fs");const filter=process.argv.at(-1);const value=JSON.parse(fs.readFileSync(0,"utf8"));if(filter==="[.object.type, .object.sha] | @tsv"){const fields=[value.object?.type,value.object?.sha];if(fields.some((field)=>typeof field!=="string"))process.exit(1);process.stdout.write(fields.join("\\t")+"\\n");}else if(filter===".status // empty"){if(value.status!=null)process.stdout.write(String(value.status)+"\\n");}else process.exit(64);\' -- "$@"',
@@ -503,24 +511,16 @@ describe("reviewed release note helpers", () => {
writeFileSync(taggedNotes, "<!-- release-version: 1.2.3 -->\n\0\n");
writeFileSync(generatedNotes, "Generated release notes\n");
- const result = await runCommand(
- bash,
+ const result = await runShell(
[
- "-c",
- [
- "set -euo pipefail",
- 'published_notes="$(node "$AUTOMATION_SCRIPT" compose-release-notes 1.2.3 "$GENERATED_NOTES" --tagged-notes-file "$TAGGED_NOTES")"',
- 'printf "%s" "$published_notes"',
- ].join("\n"),
- ],
+ "set -euo pipefail",
+ 'published_notes="$(node "$AUTOMATION_SCRIPT" compose-release-notes 1.2.3 "$GENERATED_NOTES" --tagged-notes-file "$TAGGED_NOTES")"',
+ 'printf "%s" "$published_notes"',
+ ].join("\n"),
{
- env: {
- ...process.env,
- AUTOMATION_SCRIPT: fileURLToPath(automationScript),
- GENERATED_NOTES: generatedNotes,
- TAGGED_NOTES: taggedNotes,
- },
- timeout: 10_000,
+ AUTOMATION_SCRIPT: fileURLToPath(automationScript),
+ GENERATED_NOTES: generatedNotes,
+ TAGGED_NOTES: taggedNotes,
},
);
@@ -1258,147 +1258,156 @@ describe("cryptographically verified npm provenance", () => {
}
});
- test("rejects a certificate from another OIDC issuer", () => {
- expect(() =>
- verifySignatureAudit(
- signatureAudit({
- signingCertificate: signingCertificateWithReplacement(
- "token.actions.githubusercontent.com",
- "token.actions.githabusercontent.com",
- ),
- }),
- archive,
- signatureExpected(),
- ),
- ).toThrow(
- "The Fulcio certificate must use the GitHub Actions OIDC issuer.",
- );
- });
-
- test("rejects a certificate for another GitHub Actions workflow", () => {
- expect(() =>
- verifySignatureAudit(
- signatureAudit({
- signingCertificate: signingCertificateWithReplacement(
- "node-release.yml",
- "fake-release.yml",
- ),
- }),
- archive,
- signatureExpected(),
- ),
- ).toThrow(
- "The Fulcio certificate must identify the protected release workflow.",
- );
- });
-
- test("rejects a certificate for a different release commit", () => {
- expect(() =>
- verifySignatureAudit(
- signatureAudit({
- signingCertificate: signingCertificateWithReplacement(
- releaseCommit,
- "2e03c89ad22d2df5ae65b146be1483b3608572a9",
- ),
- }),
- archive,
- signatureExpected(),
- ),
- ).toThrow("The Fulcio certificate must identify the exact release commit.");
- });
-
- test("rejects a certificate for another release run", () => {
- expect(() =>
- verifySignatureAudit(
- signatureAudit({
- signingCertificate: signingCertificateWithReplacement(
- releaseRun,
- "30481596228",
- ),
- }),
- archive,
- signatureExpected(),
- ),
- ).toThrow("The Fulcio certificate must identify the exact release run.");
- });
-
- test("rejects a certificate outside the protected npm environment", () => {
- expect(() =>
- verifySignatureAudit(
- signatureAudit({
- signingCertificate: signingCertificateWithReplacement(
- "environment:npm",
- "environment:dev",
- ),
- }),
- archive,
- signatureExpected(),
- ),
- ).toThrow(
- "The Fulcio certificate must identify the protected npm environment.",
- );
- });
-
- test("rejects invalid or missing registry signatures", () => {
- expect(() =>
- verifySignatureAudit(
- signatureAudit({ invalid: [{ name: "@openai/codex-security" }] }),
- archive,
- signatureExpected(),
- ),
- ).toThrow("npm registry signatures and attestations must verify.");
- expect(() =>
- verifySignatureAudit(
- signatureAudit({ missing: [{ name: "@openai/codex-security" }] }),
- archive,
- signatureExpected(),
- ),
- ).toThrow("npm registry signatures and attestations must verify.");
- });
-
- test("requires the exact published package in the verified audit", () => {
- expect(() =>
- verifySignatureAudit(
- signatureAudit({ includeVerified: false }),
- archive,
- signatureExpected(),
- ),
- ).toThrow(
- "The published package must have a cryptographically verified attestation.",
- );
- expect(() =>
- verifySignatureAudit(
- signatureAudit({ name: "@openai/codex" }),
- archive,
- signatureExpected(),
- ),
- ).toThrow(
- "The published package must have a cryptographically verified attestation.",
- );
- });
-
- test("requires the signed public npm registry and SLSA bundle", () => {
- expect(() =>
- verifySignatureAudit(
- signatureAudit({ registry: "https://registry.example/" }),
- archive,
- signatureExpected(),
- ),
- ).toThrow("Verified provenance must come from the public npm registry.");
- expect(() =>
- verifySignatureAudit(
- signatureAudit({ includeProvenance: false }),
- archive,
- signatureExpected(),
- ),
- ).toThrow("The verified npm package must have SLSA v1 provenance.");
+ test.each([
+ {
+ name: "rejects a certificate from another OIDC issuer",
+ options: () => ({
+ signingCertificate: signingCertificateWithReplacement(
+ "token.actions.githubusercontent.com",
+ "token.actions.githabusercontent.com",
+ ),
+ }),
+ message:
+ "The Fulcio certificate must use the GitHub Actions OIDC issuer.",
+ },
+ {
+ name: "rejects a certificate for another GitHub Actions workflow",
+ options: () => ({
+ signingCertificate: signingCertificateWithReplacement(
+ "node-release.yml",
+ "fake-release.yml",
+ ),
+ }),
+ message:
+ "The Fulcio certificate must identify the protected release workflow.",
+ },
+ {
+ name: "rejects a certificate for a different release commit",
+ options: () => ({
+ signingCertificate: signingCertificateWithReplacement(
+ releaseCommit,
+ "2e03c89ad22d2df5ae65b146be1483b3608572a9",
+ ),
+ }),
+ message: "The Fulcio certificate must identify the exact release commit.",
+ },
+ {
+ name: "rejects a certificate for another release run",
+ options: () => ({
+ signingCertificate: signingCertificateWithReplacement(
+ releaseRun,
+ "30481596228",
+ ),
+ }),
+ message: "The Fulcio certificate must identify the exact release run.",
+ },
+ {
+ name: "rejects a certificate outside the protected npm environment",
+ options: () => ({
+ signingCertificate: signingCertificateWithReplacement(
+ "environment:npm",
+ "environment:dev",
+ ),
+ }),
+ message:
+ "The Fulcio certificate must identify the protected npm environment.",
+ },
+ {
+ name: "rejects invalid or missing registry signatures: invalid",
+ options: () => ({ invalid: [{ name: "@openai/codex-security" }] }),
+ message: "npm registry signatures and attestations must verify.",
+ },
+ {
+ name: "rejects invalid or missing registry signatures: missing",
+ options: () => ({ missing: [{ name: "@openai/codex-security" }] }),
+ message: "npm registry signatures and attestations must verify.",
+ },
+ {
+ name: "requires the exact published package in the verified audit: includeVerified",
+ options: () => ({ includeVerified: false }),
+ message:
+ "The published package must have a cryptographically verified attestation.",
+ },
+ {
+ name: "requires the exact published package in the verified audit: name",
+ options: () => ({ name: "@openai/codex" }),
+ message:
+ "The published package must have a cryptographically verified attestation.",
+ },
+ {
+ name: "requires the signed public npm registry and SLSA bundle: registry",
+ options: () => ({ registry: "https://registry.example/" }),
+ message: "Verified provenance must come from the public npm registry.",
+ },
+ {
+ name: "requires the signed public npm registry and SLSA bundle: includeProvenance",
+ options: () => ({ includeProvenance: false }),
+ message: "The verified npm package must have SLSA v1 provenance.",
+ },
+ {
+ name: "requires the signed public npm registry and SLSA bundle: includeBundle",
+ options: () => ({ includeBundle: false }),
+ message: "The verified SLSA provenance bundle is missing.",
+ },
+ {
+ name: "rejects provenance for a different package subject or archive: subjectName",
+ options: () => ({ subjectName: "pkg:npm/[email protected]" }),
+ message:
+ "Verified SLSA provenance must identify the exact published tarball.",
+ },
+ {
+ name: "rejects provenance for a different package subject or archive: subjectDigest",
+ options: () => ({ subjectDigest: "incorrect" }),
+ message:
+ "Verified SLSA provenance must identify the exact published tarball.",
+ },
+ {
+ name: "rejects another repository, workflow, or release tag: repository",
+ options: () => ({ repository: "attacker/codex-security" }),
+ message:
+ "Verified SLSA provenance must identify the protected release workflow.",
+ },
+ {
+ name: "rejects another repository, workflow, or release tag: workflowPath",
+ options: () => ({
+ workflowPath: ".github/workflows/untrusted-release.yml",
+ }),
+ message:
+ "Verified SLSA provenance must identify the protected release workflow.",
+ },
+ {
+ name: "rejects another repository, workflow, or release tag: workflowRef",
+ options: () => ({ workflowRef: "refs/heads/npm-v0.1.2" }),
+ message:
+ "Verified SLSA provenance must identify the protected release workflow.",
+ },
+ {
+ name: "rejects a source commit outside the protected release",
+ options: () => ({
+ sourceCommit: "0000000000000000000000000000000000000000",
+ }),
+ message: "npm package gitHead must match release commit",
+ },
+ {
+ name: "rejects provenance from another release run or builder: runId",
+ options: () => ({ runId: "12345" }),
+ message:
+ "Verified SLSA provenance must identify the successful release run.",
+ },
+ {
+ name: "rejects provenance from another release run or builder: builder",
+ options: () => ({ builder: "https://example.com/untrusted-runner" }),
+ message:
+ "Verified SLSA provenance must use a GitHub-hosted release runner.",
+ },
+ ])("$name", ({ options, message }) => {
expect(() =>
verifySignatureAudit(
- signatureAudit({ includeBundle: false }),
+ signatureAudit(options()),
archive,
signatureExpected(),
),
- ).toThrow("The verified SLSA provenance bundle is missing.");
+ ).toThrow(message);
});
test("rejects malformed attestation bundle collections safely", () => {
@@ -1418,92 +1427,6 @@ describe("cryptographically verified npm provenance", () => {
).toThrow("The verified SLSA provenance bundle is missing.");
}
});
-
- test("rejects provenance for a different package subject or archive", () => {
- expect(() =>
- verifySignatureAudit(
- signatureAudit({ subjectName: "pkg:npm/[email protected]" }),
- archive,
- signatureExpected(),
- ),
- ).toThrow(
- "Verified SLSA provenance must identify the exact published tarball.",
- );
- expect(() =>
- verifySignatureAudit(
- signatureAudit({ subjectDigest: "incorrect" }),
- archive,
- signatureExpected(),
- ),
- ).toThrow(
- "Verified SLSA provenance must identify the exact published tarball.",
- );
- });
-
- test("rejects another repository, workflow, or release tag", () => {
- expect(() =>
- verifySignatureAudit(
- signatureAudit({ repository: "attacker/codex-security" }),
- archive,
- signatureExpected(),
- ),
- ).toThrow(
- "Verified SLSA provenance must identify the protected release workflow.",
- );
- expect(() =>
- verifySignatureAudit(
- signatureAudit({
- workflowPath: ".github/workflows/untrusted-release.yml",
- }),
- archive,
- signatureExpected(),
- ),
- ).toThrow(
- "Verified SLSA provenance must identify the protected release workflow.",
- );
- expect(() =>
- verifySignatureAudit(
- signatureAudit({ workflowRef: "refs/heads/npm-v0.1.2" }),
- archive,
- signatureExpected(),
- ),
- ).toThrow(
- "Verified SLSA provenance must identify the protected release workflow.",
- );
- });
-
- test("rejects a source commit outside the protected release", () => {
- expect(() =>
- verifySignatureAudit(
- signatureAudit({
- sourceCommit: "0000000000000000000000000000000000000000",
- }),
- archive,
- signatureExpected(),
- ),
- ).toThrow("npm package gitHead must match release commit");
- });
-
- test("rejects provenance from another release run or builder", () => {
- expect(() =>
- verifySignatureAudit(
- signatureAudit({ runId: "12345" }),
- archive,
- signatureExpected(),
- ),
- ).toThrow(
- "Verified SLSA provenance must identify the successful release run.",
- );
- expect(() =>
- verifySignatureAudit(
- signatureAudit({ builder: "https://example.com/untrusted-runner" }),
- archive,
- signatureExpected(),
- ),
- ).toThrow(
- "Verified SLSA provenance must use a GitHub-hosted release runner.",
- );
- });
});
describe("idempotent GitHub release verification", () => {
@@ -1767,16 +1690,15 @@ describe("GitHub release workflow safeguards", () => {
" printf '%s\\n' \"$MOCK_RELEASE_SUMMARY\"",
"}",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mock}\n${script}`], {
- cwd: fileURLToPath(new URL("../../../", import.meta.url)),
- env: {
- ...process.env,
+ const result = await runShell(
+ `${mock}\n${script}`,
+ {
GITHUB_SHA: releaseCommit,
MOCK_RELEASE_SUMMARY: summary,
RELEASE_VERSION: "0.1.6",
},
- timeout: 10_000,
- });
+ fileURLToPath(new URL("../../../", import.meta.url)),
+ );
expect(result.status).toBe(status);
if (message !== "") {
@@ -1877,18 +1799,17 @@ describe("GitHub release workflow safeguards", () => {
"}",
"npm() { printf '%s\\n' '[\"0.1.1\",\"999999999999999999999999.0.0\"]'; }",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mocks}\n${script}`], {
- cwd: fileURLToPath(new URL("../../../", import.meta.url)),
- env: {
- ...process.env,
+ const result = await runShell(
+ `${mocks}\n${script}`,
+ {
BEFORE_SHA: "",
GITHUB_EVENT_NAME: "workflow_dispatch",
GITHUB_OUTPUT: "/dev/null",
GITHUB_REF: "refs/heads/main",
GITHUB_SHA: releaseCommit,
},
- timeout: 10_000,
- });
+ fileURLToPath(new URL("../../../", import.meta.url)),
+ );
expect(result.status).toBe(1);
expect(result.stderr).toContain(
@@ -1899,9 +1820,7 @@ describe("GitHub release workflow safeguards", () => {
test.each([
{
scenario: "a version-increase commit with a conflicting existing tag",
- event: "workflow_run",
previousVersion: "0.1.5",
- currentVersion: "0.1.6",
publishedVersions: ["0.1.5"],
taggedSha: "cccccccccccccccccccccccccccccccccccccccc",
taggedVersion: "0.1.6",
@@ -1909,39 +1828,23 @@ describe("GitHub release workflow safeguards", () => {
},
{
scenario: "a successful fix after the version-increase commit failed CI",
- event: "workflow_run",
- previousVersion: "0.1.6",
- currentVersion: "0.1.6",
- publishedVersions: ["0.1.5"],
changed: true,
},
{
scenario:
"an unchanged unpublished version already tagged on an ancestor",
- event: "workflow_run",
- previousVersion: "0.1.6",
- currentVersion: "0.1.6",
- publishedVersions: ["0.1.5"],
taggedSha: "cccccccccccccccccccccccccccccccccccccccc",
taggedVersion: "0.1.6",
changed: false,
},
{
scenario: "a retry at the exact tagged unpublished commit",
- event: "workflow_run",
- previousVersion: "0.1.6",
- currentVersion: "0.1.6",
- publishedVersions: ["0.1.5"],
taggedSha: releaseCommit,
taggedVersion: "0.1.6",
changed: true,
},
{
scenario: "an unchanged version with a tag outside its ancestry",
- event: "workflow_run",
- previousVersion: "0.1.6",
- currentVersion: "0.1.6",
- publishedVersions: ["0.1.5"],
taggedSha: "cccccccccccccccccccccccccccccccccccccccc",
taggedVersion: "0.1.6",
taggedAncestor: false,
@@ -1949,36 +1852,25 @@ describe("GitHub release workflow safeguards", () => {
},
{
scenario: "an unchanged version with a tag for another package version",
- event: "workflow_run",
- previousVersion: "0.1.6",
- currentVersion: "0.1.6",
- publishedVersions: ["0.1.5"],
taggedSha: "cccccccccccccccccccccccccccccccccccccccc",
taggedVersion: "0.1.5",
changed: true,
},
{
scenario: "an unchanged version that has already been published",
- event: "workflow_run",
previousVersion: "0.1.5",
currentVersion: "0.1.5",
- publishedVersions: ["0.1.5"],
changed: false,
},
{
scenario: "a manually dispatched unpublished version",
event: "workflow_dispatch",
previousVersion: "0.1.5",
- currentVersion: "0.1.6",
- publishedVersions: ["0.1.5"],
changed: true,
},
{
scenario: "a manual dispatch after an unpublished version was tagged",
event: "workflow_dispatch",
- previousVersion: "0.1.6",
- currentVersion: "0.1.6",
- publishedVersions: ["0.1.5"],
taggedSha: "cccccccccccccccccccccccccccccccccccccccc",
taggedVersion: "0.1.6",
changed: true,
@@ -1986,10 +1878,10 @@ describe("GitHub release workflow safeguards", () => {
])(
"resolves $scenario against its published npm history",
async ({
- event,
- previousVersion,
- currentVersion,
- publishedVersions,
+ event = "workflow_run",
+ previousVersion = "0.1.6",
+ currentVersion = "0.1.6",
+ publishedVersions = ["0.1.5"],
taggedSha = "",
taggedVersion = "",
taggedAncestor = true,
@@ -2047,10 +1939,9 @@ describe("GitHub release workflow safeguards", () => {
try {
const outputPath = join(workspace, "outputs");
- const result = await runCommand(bash, ["-c", `${mocks}\n${script}`], {
- cwd: fileURLToPath(new URL("../../../", import.meta.url)),
- env: {
- ...process.env,
+ const result = await runShell(
+ `${mocks}\n${script}`,
+ {
GITHUB_EVENT_NAME: event,
GITHUB_OUTPUT: outputPath,
GITHUB_REF: "refs/heads/main",
@@ -2064,8 +1955,8 @@ describe("GitHub release workflow safeguards", () => {
MOCK_TAGGED_ANCESTOR: String(taggedAncestor),
RELEASE_SHA: releaseCommit,
},
- timeout: 10_000,
- });
+ fileURLToPath(new URL("../../../", import.meta.url)),
+ );
expect(result.stderr).toBe("");
expect(result.status).toBe(0);
@@ -2123,10 +2014,9 @@ describe("GitHub release workflow safeguards", () => {
"}",
"npm() { printf '%s\\n' 'npm history must not be queried' >&2; return 70; }",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mocks}\n${script}`], {
- cwd: fileURLToPath(new URL("../../../", import.meta.url)),
- env: {
- ...process.env,
+ const result = await runShell(
+ `${mocks}\n${script}`,
+ {
GITHUB_EVENT_NAME: "workflow_dispatch",
GITHUB_OUTPUT: "/dev/null",
GITHUB_REF: "refs/heads/main",
@@ -2134,8 +2024,8 @@ describe("GitHub release workflow safeguards", () => {
MOCK_RELEASE_SUMMARY: summary,
RELEASE_SHA: releaseCommit,
},
- timeout: 10_000,
- });
+ fileURLToPath(new URL("../../../", import.meta.url)),
+ );
expect(result.status).toBe(1);
expect(result.stderr).toContain(message);
@@ -2210,10 +2100,9 @@ describe("GitHub release workflow safeguards", () => {
" return 1",
"}",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mocks}\n${script}`], {
- cwd: fileURLToPath(new URL("../../../", import.meta.url)),
- env: {
- ...process.env,
+ const result = await runShell(
+ `${mocks}\n${script}`,
+ {
BEFORE_SHA: "",
GITHUB_EVENT_NAME: "workflow_dispatch",
GITHUB_OUTPUT: "/dev/null",
@@ -2226,8 +2115,8 @@ describe("GitHub release workflow safeguards", () => {
}),
MOCK_RELEASE_VERSION: version,
},
- timeout: 10_000,
- });
+ fileURLToPath(new URL("../../../", import.meta.url)),
+ );
expect(result.status).toBe(status);
if (status !== 0) {
@@ -2443,14 +2332,12 @@ describe("GitHub release workflow safeguards", () => {
kind: "deleted release tag",
tagType: "missing",
tagObject: "",
- peeledCommit: "",
status: 1,
},
{
kind: "retargeted lightweight tag",
tagType: "commit",
tagObject: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
- peeledCommit: "",
status: 1,
},
{
@@ -2464,7 +2351,6 @@ describe("GitHub release workflow safeguards", () => {
kind: "verified lightweight tag",
tagType: "commit",
tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
@@ -2476,7 +2362,7 @@ describe("GitHub release workflow safeguards", () => {
},
])(
"revalidates the authoritative $kind immediately before npm publication",
- async ({ tagType, tagObject, peeledCommit, status }) => {
+ async ({ tagType, tagObject, peeledCommit = "", status }) => {
const script = workflowStepShell(
protectedReleaseWorkflow,
"Revalidate protected release tag",
@@ -2497,19 +2383,15 @@ describe("GitHub release workflow safeguards", () => {
" esac",
"}",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mock}\n${script}`], {
- env: {
- ...process.env,
- GITHUB_REF: `refs/tags/${checkedOutTag}`,
- GITHUB_REF_NAME: checkedOutTag,
- GITHUB_REF_TYPE: "tag",
- GITHUB_REPOSITORY: "test/codex-security",
- GITHUB_SHA: releaseCommit,
- MOCK_PEELED_COMMIT: peeledCommit,
- MOCK_TAG_OBJECT: tagObject,
- MOCK_TAG_TYPE: tagType,
- },
- timeout: 10_000,
+ const result = await runShell(`${mock}\n${script}`, {
+ GITHUB_REF: `refs/tags/${checkedOutTag}`,
+ GITHUB_REF_NAME: checkedOutTag,
+ GITHUB_REF_TYPE: "tag",
+ GITHUB_REPOSITORY: "test/codex-security",
+ GITHUB_SHA: releaseCommit,
+ MOCK_PEELED_COMMIT: peeledCommit,
+ MOCK_TAG_OBJECT: tagObject,
+ MOCK_TAG_TYPE: tagType,
});
expect(result.status).toBe(status);
@@ -2534,18 +2416,17 @@ describe("GitHub release workflow safeguards", () => {
"git() { return 0; }",
"sfw() { printf '%s\\n' '[\"0.1.1\",\"999999999999999999999999.0.0\"]'; }",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mocks}\n${script}`], {
- cwd: fileURLToPath(new URL("../../../", import.meta.url)),
- env: {
- ...process.env,
+ const result = await runShell(
+ `${mocks}\n${script}`,
+ {
GITHUB_OUTPUT: "/dev/null",
GITHUB_REF: `refs/tags/${checkedOutTag}`,
GITHUB_REF_NAME: checkedOutTag,
GITHUB_REF_TYPE: "tag",
GITHUB_SHA: releaseCommit,
},
- timeout: 10_000,
- });
+ fileURLToPath(new URL("../../../", import.meta.url)),
+ );
expect(result.status).toBe(1);
expect(result.stderr).toContain(
@@ -2562,18 +2443,17 @@ describe("GitHub release workflow safeguards", () => {
"git() { return 0; }",
`sfw() { printf '%s\\n' '["0.1.0","${checkedOutVersion}"]'; }`,
].join("\n");
- const result = await runCommand(bash, ["-c", `${mocks}\n${script}`], {
- cwd: fileURLToPath(new URL("../../../", import.meta.url)),
- env: {
- ...process.env,
+ const result = await runShell(
+ `${mocks}\n${script}`,
+ {
GITHUB_OUTPUT: "/dev/null",
GITHUB_REF: `refs/tags/${checkedOutTag}`,
GITHUB_REF_NAME: checkedOutTag,
GITHUB_REF_TYPE: "tag",
GITHUB_SHA: releaseCommit,
},
- timeout: 10_000,
- });
+ fileURLToPath(new URL("../../../", import.meta.url)),
+ );
expect(result.status).toBe(0);
expect(result.stdout).toContain(
@@ -2628,7 +2508,6 @@ describe("GitHub release workflow safeguards", () => {
{
description: "a version already visible in the registry",
missingAttempts: 0,
- errorCode: "E404",
calls: 1,
waits: 0,
status: 0,
@@ -2636,7 +2515,6 @@ describe("GitHub release workflow safeguards", () => {
{
description: "a version becoming visible after npm processing",
missingAttempts: 4,
- errorCode: "E404",
calls: 5,
waits: 4,
status: 0,
@@ -2644,7 +2522,6 @@ describe("GitHub release workflow safeguards", () => {
{
description: "a version remaining absent past the publication wait",
missingAttempts: 100,
- errorCode: "E404",
calls: 21,
waits: 20,
status: 1,
@@ -2659,7 +2536,7 @@ describe("GitHub release workflow safeguards", () => {
},
])(
"handles $description before GitHub release verification",
- async ({ missingAttempts, errorCode, calls, waits, status }) => {
+ async ({ missingAttempts, errorCode = "E404", calls, waits, status }) => {
const script = workflowStepShell(
githubReleaseWorkflow,
"Wait for the published npm package",
@@ -2715,14 +2592,10 @@ describe("GitHub release workflow safeguards", () => {
"Dispatch the verified GitHub release",
);
const mock = "gh() { printf '%s\\n' \"$@\"; }";
- const result = await runCommand(bash, ["-c", `${mock}\n${script}`], {
- env: {
- ...process.env,
- GITHUB_REPOSITORY: releaseRepository,
- RELEASE_RUN_ID: releaseRun,
- RELEASE_TAG: "npm-v0.1.2",
- },
- timeout: 10_000,
+ const result = await runShell(`${mock}\n${script}`, {
+ GITHUB_REPOSITORY: releaseRepository,
+ RELEASE_RUN_ID: releaseRun,
+ RELEASE_TAG: "npm-v0.1.2",
});
expect(result.status).toBe(0);
@@ -2797,16 +2670,12 @@ describe("GitHub release workflow safeguards", () => {
].join("\n");
try {
- const result = await runCommand(bash, ["-c", `${mocks}\n${script}`], {
- env: {
- ...process.env,
- GITHUB_OUTPUT: "/dev/null",
- GITHUB_REPOSITORY: releaseRepository,
- INPUT_RUN_ID: releaseRun,
- INPUT_TAG: "npm-v0.1.2",
- MOCK_RUN_STATE: state,
- },
- timeout: 10_000,
+ const result = await runShell(`${mocks}\n${script}`, {
+ GITHUB_OUTPUT: "/dev/null",
+ GITHUB_REPOSITORY: releaseRepository,
+ INPUT_RUN_ID: releaseRun,
+ INPUT_TAG: "npm-v0.1.2",
+ MOCK_RUN_STATE: state,
});
expect(result.status).toBe(0);
@@ -2839,15 +2708,11 @@ describe("GitHub release workflow safeguards", () => {
"}",
"sleep() { return 99; }",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mocks}\n${script}`], {
- env: {
- ...process.env,
- GITHUB_OUTPUT: "/dev/null",
- GITHUB_REPOSITORY: releaseRepository,
- INPUT_RUN_ID: releaseRun,
- INPUT_TAG: "npm-v0.1.2",
- },
- timeout: 10_000,
+ const result = await runShell(`${mocks}\n${script}`, {
+ GITHUB_OUTPUT: "/dev/null",
+ GITHUB_REPOSITORY: releaseRepository,
+ INPUT_RUN_ID: releaseRun,
+ INPUT_TAG: "npm-v0.1.2",
});
expect(result.status).toBe(1);
@@ -2877,15 +2742,11 @@ describe("GitHub release workflow safeguards", () => {
"}",
"sleep() { :; }",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mocks}\n${script}`], {
- env: {
- ...process.env,
- GITHUB_OUTPUT: "/dev/null",
- GITHUB_REPOSITORY: releaseRepository,
- INPUT_RUN_ID: releaseRun,
- INPUT_TAG: "npm-v0.1.2",
- },
- timeout: 10_000,
+ const result = await runShell(`${mocks}\n${script}`, {
+ GITHUB_OUTPUT: "/dev/null",
+ GITHUB_REPOSITORY: releaseRepository,
+ INPUT_RUN_ID: releaseRun,
+ INPUT_TAG: "npm-v0.1.2",
});
expect(result.status).toBe(1);
@@ -2917,15 +2778,11 @@ describe("GitHub release workflow safeguards", () => {
" esac",
"}",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mock}\n${script}`], {
- env: {
- ...process.env,
- GITHUB_OUTPUT: "/dev/null",
- GITHUB_REPOSITORY: "openai/codex-security",
- INPUT_RUN_ID: releaseRun,
- INPUT_TAG: "npm-v0.1.2",
- },
- timeout: 10_000,
+ const result = await runShell(`${mock}\n${script}`, {
+ GITHUB_OUTPUT: "/dev/null",
+ GITHUB_REPOSITORY: "openai/codex-security",
+ INPUT_RUN_ID: releaseRun,
+ INPUT_TAG: "npm-v0.1.2",
});
expect(result.status).toBe(1);
@@ -2979,16 +2836,12 @@ describe("GitHub release workflow safeguards", () => {
" esac",
"}",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mocks}\n${script}`], {
- env: {
- ...process.env,
- GITHUB_OUTPUT: "/dev/null",
- GITHUB_REPOSITORY: "openai/codex-security",
- INPUT_RUN_ID: releaseRun,
- INPUT_TAG: "npm-v0.1.2",
- MOCK_TAG_TYPE: tagType,
- },
- timeout: 10_000,
+ const result = await runShell(`${mocks}\n${script}`, {
+ GITHUB_OUTPUT: "/dev/null",
+ GITHUB_REPOSITORY: "openai/codex-security",
+ INPUT_RUN_ID: releaseRun,
+ INPUT_TAG: "npm-v0.1.2",
+ MOCK_TAG_TYPE: tagType,
});
expect(result.status).toBe(0);
@@ -3020,15 +2873,11 @@ describe("GitHub release workflow safeguards", () => {
" esac",
"}",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mocks}\n${script}`], {
- env: {
- ...process.env,
- GITHUB_OUTPUT: "/dev/null",
- GITHUB_REPOSITORY: "openai/codex-security",
- INPUT_RUN_ID: runId,
- INPUT_TAG: "npm-v0.1.2",
- },
- timeout: 10_000,
+ const result = await runShell(`${mocks}\n${script}`, {
+ GITHUB_OUTPUT: "/dev/null",
+ GITHUB_REPOSITORY: "openai/codex-security",
+ INPUT_RUN_ID: runId,
+ INPUT_TAG: "npm-v0.1.2",
});
expect(result.status).toBe(1);
@@ -3041,15 +2890,10 @@ describe("GitHub release workflow safeguards", () => {
test.each([
{
description: "verified lightweight release tag",
- existingLookup: "missing",
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
description: "verified annotated release tag",
- existingLookup: "missing",
tagType: "tag",
tagObject: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
peeledCommit: releaseCommit,
@@ -3057,23 +2901,17 @@ describe("GitHub release workflow safeguards", () => {
},
{
description: "deleted release tag",
- existingLookup: "missing",
tagType: "missing",
tagObject: "",
- peeledCommit: "",
status: 1,
},
{
description: "retargeted lightweight release tag",
- existingLookup: "missing",
- tagType: "commit",
tagObject: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
- peeledCommit: "",
status: 1,
},
{
description: "retargeted annotated release tag",
- existingLookup: "missing",
tagType: "tag",
tagObject: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
peeledCommit: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
@@ -3082,38 +2920,32 @@ describe("GitHub release workflow safeguards", () => {
{
description: "release lookup returning an unexpected HTTP 500",
existingLookup: "unavailable",
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 1,
},
{
description: "release lookup rejecting its authentication",
existingLookup: "unauthorized",
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 1,
},
{
description: "release lookup without an HTTP response",
existingLookup: "network",
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 1,
},
{
description: "release lookup returning a malformed HTTP 404",
existingLookup: "malformed",
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 1,
},
])(
"revalidates the $description immediately before creating its GitHub release",
- async ({ existingLookup, tagType, tagObject, peeledCommit, status }) => {
+ async ({
+ existingLookup = "missing",
+ tagType = "commit",
+ tagObject = releaseCommit,
+ peeledCommit = "",
+ status,
+ }) => {
const script = workflowStepShell(
githubReleaseWorkflow,
"Publish GitHub Release and generated notes",
@@ -3241,31 +3073,25 @@ describe("GitHub release workflow safeguards", () => {
description: "the exact successful publishing run",
exact: true,
recoveryConclusion: "skipped",
- originalCommit: releaseCommit,
status: 0,
message: "Verified npm provenance for the resolved release run.",
},
{
description: "a different signing run without authenticated recovery",
- exact: false,
recoveryConclusion: "skipped",
- originalCommit: releaseCommit,
status: 1,
message:
"Signed npm provenance must identify the resolved successful release run.",
},
{
description: "the authenticated original signing run after recovery",
- exact: false,
recoveryConclusion: "success",
- originalCommit: releaseCommit,
status: 0,
message:
"Verified protected recovery provenance from its original signing run.",
},
{
description: "a recovery provenance run for a different source commit",
- exact: false,
recoveryConclusion: "success",
originalCommit: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
status: 1,
@@ -3274,7 +3100,13 @@ describe("GitHub release workflow safeguards", () => {
},
])(
"binds GitHub release provenance to $description",
- async ({ exact, recoveryConclusion, originalCommit, status, message }) => {
+ async ({
+ exact = false,
+ recoveryConclusion,
+ originalCommit = releaseCommit,
+ status,
+ message,
+ }) => {
const script = workflowStepShell(
githubReleaseWorkflow,
"Verify the public npm package and signed provenance",
@@ -3333,10 +3165,9 @@ describe("GitHub release workflow safeguards", () => {
" esac",
"}",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mocks}\n${script}`], {
- cwd: workspace,
- env: {
- ...process.env,
+ const result = await runShell(
+ `${mocks}\n${script}`,
+ {
GITHUB_OUTPUT: "/dev/null",
GITHUB_REPOSITORY: "test/codex-security",
MOCK_EXACT_PROVENANCE: exact ? "1" : "0",
@@ -3348,8 +3179,8 @@ describe("GitHub release workflow safeguards", () => {
RELEASE_TAG: "npm-v0.1.2",
RELEASE_VERSION: "0.1.2",
},
- timeout: 10_000,
- });
+ workspace,
+ );
expect(result.status).toBe(status);
if (status === 0) {
@@ -3368,24 +3199,14 @@ describe("GitHub release workflow safeguards", () => {
description: "empty",
existingNotes: "",
updated: true,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
description: "manually written",
existingNotes: "Manually written release notes",
updated: true,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
@@ -3394,12 +3215,7 @@ describe("GitHub release workflow safeguards", () => {
"<!-- codex-security-release-summary:start -->\\n## Highlights\\nPreserved historical summary\\n<!-- codex-security-release-summary:end -->\\n\\nStale generated notes",
expectedSummary: "Preserved historical summary",
updated: true,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
@@ -3408,12 +3224,7 @@ describe("GitHub release workflow safeguards", () => {
"<!-- codex-security-release-summary:start -->\\r\\nPreserved historical summary\\r\\n<!-- codex-security-release-summary:end -->\\r\\n\\r\\nStale generated notes",
expectedSummary: "Preserved historical summary",
updated: true,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
@@ -3422,12 +3233,7 @@ describe("GitHub release workflow safeguards", () => {
"<!-- codex-security-release-summary:start -->\\r\\nPreserved historical summary\\r\\n<!-- codex-security-release-summary:end -->\\r\\n",
expectedSummary: "Preserved historical summary",
updated: true,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
@@ -3436,12 +3242,7 @@ describe("GitHub release workflow safeguards", () => {
"* fix: <!-- codex-security-release-summary:start -->Unreviewed injected highlight<!-- codex-security-release-summary:end --> by @contributor",
excludedSummary: "Unreviewed injected highlight",
updated: true,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
@@ -3450,12 +3251,7 @@ describe("GitHub release workflow safeguards", () => {
"* fix: generated title\\n<!-- codex-security-release-summary:start -->\\nUnreviewed injected highlight\\n<!-- codex-security-release-summary:end -->",
excludedSummary: "Unreviewed injected highlight",
updated: true,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
@@ -3464,12 +3260,7 @@ describe("GitHub release workflow safeguards", () => {
"<!-- codex-security-release-summary:start -->\\nFirst\\n<!-- codex-security-release-summary:end -->\\n\\n<!-- codex-security-release-summary:start -->\\nSecond\\n<!-- codex-security-release-summary:end -->",
expectedError: "Existing release summary markers are malformed.",
updated: false,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 1,
},
{
@@ -3478,27 +3269,16 @@ describe("GitHub release workflow safeguards", () => {
"<!-- codex-security-release-summary:start -->\\nReviewed\\u0000summary\\n<!-- codex-security-release-summary:end -->",
expectedError: "Existing release summary is empty.",
updated: false,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 1,
},
{
description: "generated notes without its tagged reviewed summary",
- existingNotes: "Generated release notes",
releaseSummary:
"<!-- release-version: 0.1.2 -->\n## Highlights\nReviewed tagged summary",
expectedSummary: "Reviewed tagged summary",
updated: true,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
@@ -3507,36 +3287,20 @@ describe("GitHub release workflow safeguards", () => {
"<!-- codex-security-release-summary:start -->\\nIncomplete summary",
expectedError: "Existing release summary markers are malformed.",
updated: false,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 1,
},
{
description: "already current",
- existingNotes: "Generated release notes",
updated: false,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
description: "already current with trailing line feeds",
existingNotes: "Generated release notes\\n\\n",
updated: false,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
@@ -3544,12 +3308,7 @@ describe("GitHub release workflow safeguards", () => {
existingNotes: "Generated release notes\\r\\n",
generatedNotes: "Generated release notes\r\n",
updated: false,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
@@ -3557,111 +3316,74 @@ describe("GitHub release workflow safeguards", () => {
existingNotes: "Generated release notes\\u0000",
generatedNotesBase64: "R2VuZXJhdGVkIHJlbGVhc2Ugbm90ZXMA",
updated: false,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
description: "empty generated notes",
- existingNotes: "Generated release notes",
generatedNotes: "",
expectedError: "Generated GitHub release notes must not be empty.",
updated: false,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 1,
},
{
description:
"already current on a release predating release-note configuration",
- existingNotes: "Generated release notes",
updated: false,
latestTag: "npm-v0.1.2",
makeLatest: true,
latestUpdated: false,
releaseConfiguration: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
description:
"already current on a newest release incorrectly marked non-Latest",
- existingNotes: "Generated release notes",
updated: false,
latestTag: "npm-v0.1.1",
makeLatest: true,
latestUpdated: true,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
description: "already current when no GitHub release is marked Latest",
- existingNotes: "Generated release notes",
updated: false,
latestTag: "__missing__",
makeLatest: true,
latestUpdated: true,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 0,
},
{
description: "already current when the Latest lookup fails unexpectedly",
- existingNotes: "Generated release notes",
updated: false,
latestTag: "__error__",
makeLatest: true,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 1,
},
{
description:
"already current when the Latest lookup has no HTTP response",
- existingNotes: "Generated release notes",
updated: false,
latestTag: "__network__",
makeLatest: true,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 1,
},
{
description: "already current when the Latest 404 response is malformed",
- existingNotes: "Generated release notes",
updated: false,
latestTag: "__malformed_missing__",
makeLatest: true,
latestUpdated: false,
- tagType: "commit",
- tagObject: releaseCommit,
- peeledCommit: "",
status: 1,
},
{
description:
"already current on a historical release incorrectly marked Latest",
- existingNotes: "Generated release notes",
updated: false,
latestTag: "npm-v0.1.2",
- makeLatest: false,
latestUpdated: true,
tagType: "tag",
tagObject: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -3672,20 +3394,14 @@ describe("GitHub release workflow safeguards", () => {
description: "stale when its lightweight release tag was retargeted",
existingNotes: "Manually written release notes",
updated: false,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
- tagType: "commit",
tagObject: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
- peeledCommit: "",
status: 1,
},
{
description: "stale when its annotated release tag was retargeted",
existingNotes: "Manually written release notes",
updated: false,
- latestTag: "npm-v0.1.3",
- makeLatest: false,
latestUpdated: false,
tagType: "tag",
tagObject: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -3695,21 +3411,21 @@ describe("GitHub release workflow safeguards", () => {
])(
"reconciles $description notes on an existing verified GitHub release",
async ({
- existingNotes,
+ existingNotes = "Generated release notes",
generatedNotes = "Generated release notes\n",
generatedNotesBase64,
updated,
- latestTag,
- makeLatest,
+ latestTag = "npm-v0.1.3",
+ makeLatest = false,
latestUpdated,
releaseConfiguration = true,
releaseSummary = "__missing__",
expectedSummary,
excludedSummary,
expectedError,
- tagType,
- tagObject,
- peeledCommit,
+ tagType = "commit",
+ tagObject = releaseCommit,
+ peeledCommit = "",
status,
}) => {
const script = workflowStepShell(
@@ -4288,14 +4004,10 @@ describe("GitHub release workflow safeguards", () => {
" return 70",
"}",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mock}\n${script}`], {
- env: {
- ...process.env,
- GITHUB_REPOSITORY: "test/codex-security",
- MOCK_PR_TITLE: title,
- PR_NUMBER: "17",
- },
- timeout: 10_000,
+ const result = await runShell(`${mock}\n${script}`, {
+ GITHUB_REPOSITORY: "test/codex-security",
+ MOCK_PR_TITLE: title,
+ PR_NUMBER: "17",
});
expect(result.status).toBe(1);
@@ -4361,14 +4073,10 @@ describe("GitHub release workflow safeguards", () => {
" esac",
"}",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mock}\n${script}`], {
- env: {
- ...process.env,
- GITHUB_REPOSITORY: "test/codex-security",
- MOCK_PR_TITLE: title,
- PR_NUMBER: "17",
- },
- timeout: 10_000,
+ const result = await runShell(`${mock}\n${script}`, {
+ GITHUB_REPOSITORY: "test/codex-security",
+ MOCK_PR_TITLE: title,
+ PR_NUMBER: "17",
});
expect(result.status).toBe(0);
@@ -4433,13 +4141,9 @@ describe("GitHub release workflow safeguards", () => {
" esac",
"}",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mock}\n${script}`], {
- env: {
- ...process.env,
- GITHUB_REPOSITORY: "test/codex-security",
- PR_NUMBER: "17",
- },
- timeout: 10_000,
+ const result = await runShell(`${mock}\n${script}`, {
+ GITHUB_REPOSITORY: "test/codex-security",
+ PR_NUMBER: "17",
});
expect(result.status).toBe(0);
@@ -4496,14 +4200,10 @@ describe("GitHub release workflow safeguards", () => {
" esac",
"}",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mock}\n${script}`], {
- env: {
- ...process.env,
- GITHUB_REPOSITORY: "test/codex-security",
- MOCK_PR_TITLE: title,
- PR_NUMBER: "17",
- },
- timeout: 10_000,
+ const result = await runShell(`${mock}\n${script}`, {
+ GITHUB_REPOSITORY: "test/codex-security",
+ MOCK_PR_TITLE: title,
+ PR_NUMBER: "17",
});
expect(result.status).toBe(0);
@@ -4571,14 +4271,10 @@ describe("GitHub release workflow safeguards", () => {
" esac",
"}",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mock}\n${script}`], {
- env: {
- ...process.env,
- GITHUB_REPOSITORY: "test/codex-security",
- MOCK_PR_TITLE: title,
- PR_NUMBER: "17",
- },
- timeout: 10_000,
+ const result = await runShell(`${mock}\n${script}`, {
+ GITHUB_REPOSITORY: "test/codex-security",
+ MOCK_PR_TITLE: title,
+ PR_NUMBER: "17",
});
expect(result.status).toBe(0);
@@ -4629,14 +4325,10 @@ describe("GitHub release workflow safeguards", () => {
" esac",
"}",
].join("\n");
- const result = await runCommand(bash, ["-c", `${mock}\n${script}`], {
- env: {
- ...process.env,
- GITHUB_REPOSITORY: "test/codex-security",
- MOCK_PR_TITLE: title,
- PR_NUMBER: "17",
- },
- timeout: 10_000,
+ const result = await runShell(`${mock}\n${script}`, {
+ GITHUB_REPOSITORY: "test/codex-security",
+ MOCK_PR_TITLE: title,
+ PR_NUMBER: "17",
});
expect(result.status).toBe(0);