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: simplify scan result construction (#1445)
mldangelo-oai2e1736d311e3
diff --git a/plugins/codex-security/mcp-app/src/deep-scan/store.ts b/plugins/codex-security/mcp-app/src/deep-scan/store.tsindex 3395ab4e0..5110d5f2e 100644--- a/plugins/codex-security/mcp-app/src/deep-scan/store.ts+++ b/plugins/codex-security/mcp-app/src/deep-scan/store.ts@@ -529,19 +529,11 @@ export class WorkbenchDeepScanStore {workerId: failure.workerId,attempts: failure.attempts,elapsedMs: failure.elapsedMs,- ...(failure.code === undefined ? {} : { code: failure.code }),- ...(failure.exitCode === undefined- ? {}- : { exitCode: failure.exitCode }),- ...(failure.signal === undefined- ? {}- : { signal: failure.signal }),- ...(failure.killed === undefined- ? {}- : { killed: failure.killed }),- ...(failure.timeoutMs === undefined- ? {}- : { timeoutMs: failure.timeoutMs }),+ code: failure.code,+ exitCode: failure.exitCode,+ signal: failure.signal,+ killed: failure.killed,+ timeoutMs: failure.timeoutMs,error: boundedDeepScanErrorMessage(error),}),);diff --git a/sdk/typescript/src/api.ts b/sdk/typescript/src/api.tsindex ca543f194..6a28dc31f 100644--- a/sdk/typescript/src/api.ts+++ b/sdk/typescript/src/api.ts@@ -1683,9 +1683,7 @@ export class CodexSecurity {JSON.stringify({recipe,userContext: options.scanPrompt,- ...(options.workflowId === undefined- ? {}- : { workflowId: options.workflowId }),+ workflowId: options.workflowId,}),);const scanId = registration["scanId"];@@ -3302,9 +3300,7 @@ export class CodexSecurity {mock: true,},userContext: options.scanPrompt,- ...(options.workflowId === undefined- ? {}- : { workflowId: options.workflowId }),+ workflowId: options.workflowId,}),);const scanId = registration["scanId"];diff --git a/sdk/typescript/src/multiscan.ts b/sdk/typescript/src/multiscan.tsindex fe2c94cf7..40d4c2838 100644--- a/sdk/typescript/src/multiscan.ts+++ b/sdk/typescript/src/multiscan.ts@@ -347,21 +347,20 @@ async function runCampaign(pending.push(task);}const skipped = completed + incomplete + untouched;- if (pending.length === 0) {- return {- total: tasks.length,- completed,- incomplete,- failed: 0,- skipped,- resultsPath: ledger,- ...(warnings.length === 0 ? {} : { warnings }),- ...(hasPolicy ? { policyFailed } : {}),- };- }+ let failed = 0;+ const summarize = (): MultiscanResult => ({+ total: tasks.length,+ completed,+ incomplete,+ failed,+ skipped,+ resultsPath: ledger,+ ...(warnings.length === 0 ? {} : { warnings }),+ ...(hasPolicy ? { policyFailed } : {}),+ });+ if (pending.length === 0) return summarize();let next = 0;- let failed = 0;const worker = async (security: Pick<CodexSecurity, "run" | "close">,): Promise<void> => {@@ -586,9 +585,7 @@ async function runCampaign(...(knowledgeBaseFailure ? { knowledgeBaseFailure: true } : {}),...(warning === undefined ? {} : { warning }),...(runWarnings.length === 0 ? {} : { warnings: runWarnings }),- ...(attemptPolicyFailed === undefined- ? {}- : { policyFailed: attemptPolicyFailed }),+ policyFailed: attemptPolicyFailed,})}\n`,);if (@@ -637,16 +634,7 @@ async function runCampaign();const rejection = results.find((result) => result.status === "rejected");if (rejection?.status === "rejected") throw rejection.reason;- return {- total: tasks.length,- completed,- incomplete,- failed,- skipped,- resultsPath: ledger,- ...(warnings.length === 0 ? {} : { warnings }),- ...(hasPolicy ? { policyFailed } : {}),- };+ return summarize();}function notifyProgress(