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(action): check RUNNER_TEMP before resolving it (#2125)
12df82a6f575e3
diff --git a/github-action/dist/index.cjs b/github-action/dist/index.cjsindex d69690d3e..8b0619e6a 100644--- a/github-action/dist/index.cjs+++ b/github-action/dist/index.cjs@@ -99554,8 +99554,8 @@ async function runAction(actionRoot, overrides = {}) {if (!inputs.dryRun && credentials.provider !== "amazon-bedrock" && (!credentials.apiKey || /[\r\n\u0000]/.test(credentials.apiKey))) {throw new Error(credentials.provider === "openai" ? "Set CODEX_SECURITY_API_KEY in Actions secrets (or Dependabot secrets for Dependabot runs) and pass it as OPENAI_API_KEY to this step. No scan was started." : `Pass ${API_KEY_ENVIRONMENT_VARIABLES[credentials.provider]} from Actions secrets to this step. No scan was started.`);}- tempRoot = await (0, import_promises10.realpath)(process.env.RUNNER_TEMP ?? "");if (!process.env.RUNNER_TEMP) throw new Error("RUNNER_TEMP is required.");+ tempRoot = await (0, import_promises10.realpath)(process.env.RUNNER_TEMP);info(`Preparing Codex Security ${SUPPORTED_CLI_VERSION}. Scope: ${inputs.scope}; mode: ${inputs.mode}; effort: ${inputs.effort}.`);const preparationStarted = performance.now();let timer = heartbeat("CLI preparation", preparationStarted);diff --git a/github-action/src/main.ts b/github-action/src/main.tsindex 22d8a6b50..aeb27b5fe 100644--- a/github-action/src/main.ts+++ b/github-action/src/main.ts@@ -84,8 +84,8 @@ export async function runAction(actionRoot: string, overrides: Partial<Dependenc? 'Set CODEX_SECURITY_API_KEY in Actions secrets (or Dependabot secrets for Dependabot runs) and pass it as OPENAI_API_KEY to this step. No scan was started.': `Pass ${API_KEY_ENVIRONMENT_VARIABLES[credentials.provider]} from Actions secrets to this step. No scan was started.`);}- tempRoot = await realpath(process.env.RUNNER_TEMP ?? '');if (!process.env.RUNNER_TEMP) throw new Error('RUNNER_TEMP is required.');+ tempRoot = await realpath(process.env.RUNNER_TEMP);core.info(`Preparing Codex Security ${SUPPORTED_CLI_VERSION}. Scope: ${inputs.scope}; mode: ${inputs.mode}; effort: ${inputs.effort}.`);const preparationStarted = performance.now();let timer = heartbeat('CLI preparation', preparationStarted);diff --git a/github-action/tests/main.test.ts b/github-action/tests/main.test.tsindex fbaf399d3..8b0cb125f 100644--- a/github-action/tests/main.test.ts+++ b/github-action/tests/main.test.ts@@ -377,6 +377,13 @@ for (const scenario of ['schedule', 'pr'] as const) {});}+test('missing RUNNER_TEMP fails with setup guidance', async (t) => {+ const app = await harness(t); delete process.env.RUNNER_TEMP;+ const result = await app.run();+ assert.equal(result.exitCode, 1); assert.equal(result.setups, 0); assert.equal(result.processes, 0);+ assert.match(result.summary, /RUNNER_TEMP is required\./);+});+test('cleanup failure fails the job and appears in the summary and final error', async (t) => {const app = await harness(t); app.configure({cleanupFails: true});const result = await app.run();