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): show scan scope limitations in the job summary (#2435)
Michael D'Angelo0497da598774
diff --git a/github-action/README.md b/github-action/README.mdindex 71daaa64b..9a313252f 100644--- a/github-action/README.md+++ b/github-action/README.md@@ -460,6 +460,9 @@ Anyone signed in to GitHub with read access to the repository can download thereports, which can contain source code and vulnerability details. Set`retention-days` to change the default of seven days.+When the scan records scope limitations, the job summary displays them. For+example, a time-limited Deep scan can finish before any source review completes.+The job summary includes the configured provider, reported input/cached/outputtoken usage, and estimated USD cost, including a range when supplied by the CLI.Missing measurements or pricing appear as `unavailable`; measured zeros remaindiff --git a/github-action/dist/index.cjs b/github-action/dist/index.cjsindex dc891e403..a63febb34 100644--- a/github-action/dist/index.cjs+++ b/github-action/dist/index.cjs@@ -54506,6 +54506,8 @@ async function analyzeResults(options) {result.errors.push(error2.message);return result;}+ const limitations = value.manifest.scan.scope?.limitations;+ if (Array.isArray(limitations)) result.scopeLimitations = limitations.filter((item) => typeof item === "string");result.counts = { critical: 0, high: 0, medium: 0, low: 0, informational: 0 };for (const finding of result.findings) result.counts[finding.severity] += 1;const usage = value.turn?.usage;@@ -97526,6 +97528,9 @@ function resultSummary(result, inputs, target, artifactUrl) {...inputs.maxCost !== void 0 ? [`**Stop threshold:** $${inputs.maxCost} (estimated; in-flight requests can exceed it)`] : [],"Applicable root and nested SECURITY.md policy is discovered by the scanner."];+ if (result.scopeLimitations?.length) {+ parts.push("**Scope limitations**\n\n" + result.scopeLimitations.map((note) => `- ${esc(note)}`).join("\n"));+ }if (result.reportStatus === "partial") parts.push("SARIF report is unavailable; scan results and other reports are still available.");if (result.scanStatus !== "completed") parts.push("**Scan execution failed. Retained findings are shown below; absence of findings is inconclusive.**");for (const error2 of result.errors.slice(0, 10)) parts.push(`<pre>${esc(error2)}</pre>`);diff --git a/github-action/src/reporting.ts b/github-action/src/reporting.tsindex a2b36ef5e..d37b9e2aa 100644--- a/github-action/src/reporting.ts+++ b/github-action/src/reporting.ts@@ -43,6 +43,9 @@ export function resultSummary(result: ScanResults, inputs: Inputs, target: Targe...(inputs.maxCost !== undefined ? [`**Stop threshold:** $${inputs.maxCost} (estimated; in-flight requests can exceed it)`] : []),'Applicable root and nested SECURITY.md policy is discovered by the scanner.',];+ if (result.scopeLimitations?.length) {+ parts.push('**Scope limitations**\n\n' + result.scopeLimitations.map(note => `- ${esc(note)}`).join('\n'));+ }if (result.reportStatus === 'partial') parts.push('SARIF report is unavailable; scan results and other reports are still available.');if (result.scanStatus !== 'completed') parts.push('**Scan execution failed. Retained findings are shown below; absence of findings is inconclusive.**');for (const error of result.errors.slice(0, 10)) parts.push(`<pre>${esc(error)}</pre>`);diff --git a/github-action/src/results.ts b/github-action/src/results.tsindex 992fdb612..3ba53476b 100644--- a/github-action/src/results.ts+++ b/github-action/src/results.ts@@ -35,6 +35,7 @@ export interface ScanResults {policyStatus: PolicyStatus;reportStatus: ReportStatus;findings: Finding[];+ scopeLimitations?: string[];counts?: Record<Severity, number>;usage?: { input_tokens: number; cached_input_tokens: number; output_tokens: number };estimatedCost?: number;@@ -143,6 +144,8 @@ export async function analyzeResults(options: ResultOptions): Promise<ScanResultresult.errors.push((error as Error).message);return result;}+ const limitations = value.manifest.scan.scope?.limitations;+ if (Array.isArray(limitations)) result.scopeLimitations = limitations.filter((item: unknown) => typeof item === 'string');result.counts = { critical: 0, high: 0, medium: 0, low: 0, informational: 0 };for (const finding of result.findings) result.counts[finding.severity] += 1;const usage = value.turn?.usage;diff --git a/github-action/tests/main.test.ts b/github-action/tests/main.test.tsindex 4daf79570..2405d8643 100644--- a/github-action/tests/main.test.ts+++ b/github-action/tests/main.test.ts@@ -769,6 +769,27 @@ test('valid empty findings publish zero counts', async (t) => {const result = await app.run();assert.equal(result.exitCode, 0);for (const level of ['critical', 'high', 'medium', 'low', 'informational']) assert.equal(result.outputs[`${level}-count`], '0');+ assert.doesNotMatch(result.summary, /Scope limitations/);+});++test('the job summary shows scope limitations from a completed scan with zero findings', async t => {+ const app = await harness(t);+ app.setInput('fail-on-severity', 'high');+ app.configure({exitCode: 0, scanResult: value => {+ value.findings.findings = [];+ value.manifest.scan.scope.limitations = [+ 'Discovery stopped before any review completed.',+ 'Unreviewed directory: <example>.',+ ];+ }});+ const result = await app.run();+ assert.equal(result.exitCode, 0);+ assert.equal(result.outputs['scan-status'], 'completed');+ assert.equal(result.outputs['policy-status'], 'passed');+ assert.equal(result.outputs['sarif-upload-ready'], 'true');+ assert.ok(result.summary.includes('**Scope limitations**'));+ assert.ok(result.summary.includes('Discovery stopped before any review completed.'));+ assert.ok(result.summary.includes('Unreviewed directory: <example>.'));});test('changed checkout during a committed diff scan fails', async (t) => {