diff --git a/lib/github/templates/security-post-release.md b/lib/github/templates/security-post-release.md index 39b150084..bf3d8f4ed 100644 --- a/lib/github/templates/security-post-release.md +++ b/lib/github/templates/security-post-release.md @@ -9,8 +9,8 @@ author: %AUTHOR% ## Security releases available -Updates are now available for the %AFFECTED_VERSIONS% Node.js release lines for the -following issues. +Updates are now available for the Node.js +%RELEASE_LINES% to address the following issues. %DEPENDENCY_UPDATES% %REPORTS% ## Downloads and release details diff --git a/lib/github/templates/security-pre-release.md b/lib/github/templates/security-pre-release.md index 2b8defe4c..8b79857b8 100644 --- a/lib/github/templates/security-pre-release.md +++ b/lib/github/templates/security-pre-release.md @@ -9,8 +9,9 @@ author: The Node.js Project # Summary -The Node.js project will release new versions of the %AFFECTED_VERSIONS% -releases lines on or shortly after, %RELEASE_DATE% in order to address: +The Node.js project will release new versions of the +%RELEASE_LINES% on or shortly after %RELEASE_DATE% +to address security vulnerabilities. %VULNERABILITIES% @@ -18,8 +19,9 @@ releases lines on or shortly after, %RELEASE_DATE% in order to address: %IMPACT% -It's important to note that End-of-Life versions are always affected when a security release occurs. -To ensure your system's security, please use an up-to-date version as outlined in our +It's important to note that End-of-Life versions are always affected when a +security release occurs. To ensure your system's security, please use an +up-to-date version as outlined in our [Release Schedule](https://github.com/nodejs/release#release-schedule). ## Release timing @@ -28,7 +30,12 @@ Releases will be available on, or shortly after, %RELEASE_DATE%. ## Contact and future updates -The current Node.js security policy can be found at . -Please follow the process outlined in if you wish to report a vulnerability in Node.js. +The current Node.js security policy can be found at +. Please follow the process outlined in + if you wish to report +a vulnerability in Node.js. -Subscribe to the low-volume announcement-only nodejs-sec mailing list at to stay up to date on security vulnerabilities and security-related releases of Node.js and the projects maintained in the nodejs GitHub organization. +Subscribe to the low-volume announcement-only nodejs-sec mailing list at + to stay up to date on +security vulnerabilities and security-related releases of Node.js and the +projects maintained in the nodejs GitHub organization. diff --git a/lib/security-release/security-release.js b/lib/security-release/security-release.js index a710c2ea2..1ded7254d 100644 --- a/lib/security-release/security-release.js +++ b/lib/security-release/security-release.js @@ -23,7 +23,7 @@ export const PLACEHOLDERS = { affectedLines: '%AFFECTED_LINES%', annoucementDate: '%ANNOUNCEMENT_DATE%', slug: '%SLUG%', - affectedVersions: '%AFFECTED_VERSIONS%', + releaseLines: '%RELEASE_LINES%', impact: '%IMPACT%', vulnerabilities: '%VULNERABILITIES%', reports: '%REPORTS%', diff --git a/lib/security_blog.js b/lib/security_blog.js index c4a01efc2..302512329 100644 --- a/lib/security_blog.js +++ b/lib/security_blog.js @@ -16,6 +16,7 @@ import auth from './auth.js'; import Request from './request.js'; const SEVERITY_ORDER = ['critical', 'high', 'medium', 'low']; +const listFormatter = new Intl.ListFormat('en', { type: 'conjunction' }); export default class SecurityBlog extends SecurityRelease { req; @@ -217,6 +218,12 @@ export default class SecurityBlog extends SecurityRelease { return releaseDate.toLocaleDateString('en-US', options); } + formatReleaseLines(affectedVersions) { + const releaseLines = affectedVersions.split(', '); + const noun = releaseLines.length === 1 ? 'release line' : 'release lines'; + return `${listFormatter.format(releaseLines)} ${noun}`; + } + buildPreRelease(template, data) { const { annoucementDate, @@ -228,7 +235,7 @@ export default class SecurityBlog extends SecurityRelease { } = data; return template.replaceAll(PLACEHOLDERS.annoucementDate, annoucementDate) .replaceAll(PLACEHOLDERS.slug, slug) - .replaceAll(PLACEHOLDERS.affectedVersions, affectedVersions) + .replaceAll(PLACEHOLDERS.releaseLines, this.formatReleaseLines(affectedVersions)) .replaceAll(PLACEHOLDERS.vulnerabilities, vulnerabilities) .replaceAll(PLACEHOLDERS.releaseDate, releaseDate) .replaceAll(PLACEHOLDERS.impact, impact); @@ -247,7 +254,7 @@ export default class SecurityBlog extends SecurityRelease { } = data; return template.replaceAll(PLACEHOLDERS.annoucementDate, annoucementDate) .replaceAll(PLACEHOLDERS.slug, slug) - .replaceAll(PLACEHOLDERS.affectedVersions, affectedVersions) + .replaceAll(PLACEHOLDERS.releaseLines, this.formatReleaseLines(affectedVersions)) .replaceAll(PLACEHOLDERS.vulnerabilities, vulnerabilities) .replaceAll(PLACEHOLDERS.releaseDate, releaseDate) .replaceAll(PLACEHOLDERS.impact, impact) @@ -280,8 +287,8 @@ export default class SecurityBlog extends SecurityRelease { if (!report.patchAuthors) { throw new Error(`Missing patch author for vulnerability ${report.link} ${report.title}`); } - template += `Thank you, to ${report.reporter} for reporting this vulnerability\ - and thank you ${report.patchAuthors.join(' and ')} for fixing it.\n\n`; + template += `Thanks to ${report.reporter} for reporting this vulnerability\n\ +and to ${listFormatter.format(report.patchAuthors)} for fixing it.\n\n`; } return template; } @@ -303,7 +310,7 @@ export default class SecurityBlog extends SecurityRelease { const releaseLines = getAffectedVersionLines(update.affectedVersions); const formattedVersions = this.formatDependencyVersions(update.versions); const versionText = formattedVersions ? ` (${formattedVersions})` : ''; - template += `- ${title}${versionText} on ${releaseLines.join(', ')}\n`; + template += `- ${title}${versionText} on ${listFormatter.format(releaseLines)}\n`; } return template; } @@ -425,7 +432,7 @@ export default class SecurityBlog extends SecurityRelease { } } - return getHighestSeverityAnnouncement(content.reports); + return getHighestSeverityAnnouncement(content.reports, 'these releases'); } getSecurityPreReleaseTemplate() { diff --git a/test/unit/security_release.test.js b/test/unit/security_release.test.js index edcf7dded..f276f89a7 100644 --- a/test/unit/security_release.test.js +++ b/test/unit/security_release.test.js @@ -954,7 +954,7 @@ describe('security_blog: pre-release severity wording', () => { assert.strictEqual( blog.getPreReleaseVulnerabilities(content), - 'The highest severity issue fixed in this release is MEDIUM.' + 'The highest severity issue fixed in these releases is MEDIUM.' ); assert.strictEqual( blog.getVulnerabilities(content), @@ -1018,9 +1018,13 @@ describe('security_blog: pre-release severity wording', () => { assert.match( preRelease, - /The highest severity issue fixed in this release is HIGH\./ + /The highest severity issue fixed in these releases is HIGH\./ + ); + assert.match( + preRelease, + /new versions of the\n24\.x and 22\.x release lines on or shortly after Tuesday, June 2, 2026\nto address/ ); - assert.doesNotMatch(preRelease, /%VULNERABILITIES%/); + assert.doesNotMatch(preRelease, /%VULNERABILITIES%|%RELEASE_LINES%/); }); it('exits when a report is missing a severity rating', () => { @@ -1093,6 +1097,7 @@ describe('security_blog: post-release severity wording', () => { ] }); + assert.match(output, /Thanks to reporter for reporting this vulnerability\nand to nodejs for fixing it\./); assert.ok(output.indexOf('## high-report') < output.indexOf('## medium-report')); assert.ok(output.indexOf('## medium-report') < output.indexOf('## low-report')); }); @@ -1117,8 +1122,8 @@ describe('security_blog: post-release severity wording', () => { } }); - assert.match(output, /- undici \(6\.22\.0, 7\.16\.0\) on 22\.x, 24\.x, 26\.x/); - assert.match(output, /- llhttp \(9\.3\.0\) on 24\.x, 22\.x/); + assert.match(output, /- undici \(6\.22\.0, 7\.16\.0\) on 22\.x, 24\.x, and 26\.x/); + assert.match(output, /- llhttp \(9\.3\.0\) on 24\.x and 22\.x/); assert.doesNotMatch(output, /\[object Object\]/); }); @@ -1133,7 +1138,7 @@ describe('security_blog: post-release severity wording', () => { } ]); - assert.match(output, /- update undici to 6\.22\.0 on 22\.x, 24\.x/); + assert.match(output, /- update undici to 6\.22\.0 on 22\.x and 24\.x/); }); }); @@ -1149,7 +1154,7 @@ describe('security_blog: getDependencyUpdatesTemplate', () => { } }); - assert.match(template, /- undici on 24\.x, 22\.x/); + assert.match(template, /- undici on 24\.x and 22\.x/); }); it('keeps rendering versions from the legacy schema', () => { @@ -1161,7 +1166,7 @@ describe('security_blog: getDependencyUpdatesTemplate', () => { } }); - assert.match(template, /- undici \(8\.5\.0\) on 22\.x, 24\.x/); + assert.match(template, /- undici \(8\.5\.0\) on 22\.x and 24\.x/); }); it('does not repeat a version listed once per release line', () => { @@ -1181,7 +1186,7 @@ describe('security_blog: getDependencyUpdatesTemplate', () => { } }); - assert.match(template, /- llhttp \(9\.4\.3\) on 26\.x, 24\.x/); + assert.match(template, /- llhttp \(9\.4\.3\) on 26\.x and 24\.x/); }); it('renders a dependency holding a list of updates', () => {