Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/github/templates/security-post-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 14 additions & 7 deletions lib/github/templates/security-pre-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ 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%

## Impact

%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
Expand All @@ -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 <https://nodejs.org/en/security/>.
Please follow the process outlined in <https://github.com/nodejs/node/blob/master/SECURITY.md> if you wish to report a vulnerability in Node.js.
The current Node.js security policy can be found at
<https://nodejs.org/en/security/>. Please follow the process outlined in
<https://github.com/nodejs/node/blob/master/SECURITY.md> if you wish to report
a vulnerability in Node.js.

Subscribe to the low-volume announcement-only nodejs-sec mailing list at <https://groups.google.com/forum/#!forum/nodejs-sec> 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
<https://groups.google.com/forum/#!forum/nodejs-sec> to stay up to date on
security vulnerabilities and security-related releases of Node.js and the
projects maintained in the nodejs GitHub organization.
2 changes: 1 addition & 1 deletion lib/security-release/security-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -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%',
Expand Down
19 changes: 13 additions & 6 deletions lib/security_blog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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);
Expand All @@ -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)
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -425,7 +432,7 @@ export default class SecurityBlog extends SecurityRelease {
}
}

return getHighestSeverityAnnouncement(content.reports);
return getHighestSeverityAnnouncement(content.reports, 'these releases');
}

getSecurityPreReleaseTemplate() {
Expand Down
23 changes: 14 additions & 9 deletions test/unit/security_release.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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'));
});
Expand All @@ -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\]/);
});

Expand All @@ -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/);
});
});

Expand All @@ -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', () => {
Expand All @@ -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', () => {
Expand All @@ -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', () => {
Expand Down
Loading