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

fix(action): use the singular for one additional finding in the job summary (#2252)

wj07c88c1bf31e
diff --git a/github-action/dist/index.cjs b/github-action/dist/index.cjs
index 71eb91216..3c97d6c0d 100644
--- a/github-action/dist/index.cjs
+++ b/github-action/dist/index.cjs
@@ -99539,7 +99539,8 @@ function resultSummary(result, inputs, target, artifactUrl) {
<pre>${esc(finding.summary, 1200)}</pre>`);
}
- if (result.findings.length > 30) parts.push(`${result.findings.length - 30} additional findings are available in the JSON/SARIF reports.`);
+ const additional = result.findings.length - 30;
+ if (additional > 0) parts.push(`${additional} additional ${additional === 1 ? "finding is" : "findings are"} available in the JSON/SARIF reports.`);
parts.push("Use the action outputs for full JSON and SARIF. Upload SARIF only when sarif-upload-ready is true. Reports can contain source code and vulnerability details.");
return Buffer.from(parts.join("\n\n")).subarray(0, 58e3).toString("utf8").replace(/\uFFFD$/, "");
}
diff --git a/github-action/src/reporting.ts b/github-action/src/reporting.ts
index 0f4460c06..cb6007062 100644
--- a/github-action/src/reporting.ts
+++ b/github-action/src/reporting.ts
@@ -49,7 +49,8 @@ export function resultSummary(result: ScanResults, inputs: Inputs, target: Targe
for (const finding of result.findings.slice(0, 30)) {
parts.push(`<h3>${finding.severity.toUpperCase()}: ${esc(finding.title, 200)}</h3>\n\n<code>${esc(finding.path ?? 'No source location')}:${finding.startLine ?? '?'}</code>\n\n<pre>${esc(finding.summary, 1200)}</pre>`);
}
- if (result.findings.length > 30) parts.push(`${result.findings.length - 30} additional findings are available in the JSON/SARIF reports.`);
+ const additional = result.findings.length - 30;
+ if (additional > 0) parts.push(`${additional} additional ${additional === 1 ? 'finding is' : 'findings are'} available in the JSON/SARIF reports.`);
parts.push('Use the action outputs for full JSON and SARIF. Upload SARIF only when sarif-upload-ready is true. Reports can contain source code and vulnerability details.');
// GitHub check output is byte bounded. Truncate at UTF-8 boundaries.
return Buffer.from(parts.join('\n\n')).subarray(0, 58_000).toString('utf8').replace(/\uFFFD$/, '');
diff --git a/github-action/tests/reporting.test.ts b/github-action/tests/reporting.test.ts
index 65dd06f8b..9fd65806b 100644
--- a/github-action/tests/reporting.test.ts
+++ b/github-action/tests/reporting.test.ts
@@ -29,6 +29,13 @@ test('finding titles and messages cannot become Markdown links, images or raw HT
assert.ok(!summary.includes('### HIGH:')); assert.ok(!summary.includes('<img'));
});
+test('findings beyond the summary limit are counted with the matching noun', () => {
+ const finding = {severity:'low',title:'Finding',summary:'Summary',path:'src/app.ts',startLine:1};
+ const summarize = (count: number) => resultSummary({scanStatus:'completed',policyStatus:'passed',reportStatus:'ready',counts:{critical:0,high:0,medium:0,low:count,informational:0},errors:[],
+ findings:Array(count).fill(finding)} as unknown as ScanResults,parseInputs(()=>'', '/checkout'),{repository:'/checkout',scannedSha:'a'.repeat(40),analysisRef:'refs/heads/main',publishable:true,emptyDiff:false});
+ assert.ok(summarize(31).includes('1 additional finding is available in the JSON/SARIF reports.'));
+ assert.ok(summarize(32).includes('2 additional findings are available in the JSON/SARIF reports.'));
+});
test('completed findings are subject to severity policy without a coverage qualification', () => {
const result = {scanStatus:'completed',policyStatus:'failed',reportStatus:'ready',counts:{critical:0,high:1,medium:0,low:0,informational:0},
errors:[],findings:[{severity:'high',title:'Extraction issue',summary:'Archive traversal reaches files outside the destination.',path:'src/extract.ts',startLine:12}]} as unknown as ScanResults;