Skip to content
Open
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
25 changes: 20 additions & 5 deletions components/git/security.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ async function skipIfExisting(cli, prURL) {
{ ignoreFailure: false, captureStdout: true });
if (existingCommit.trim()) {
cli.info(`${prURL} seems to already be on the current tree: ${existingCommit}`);
return await cli.prompt('Do you want to skip it?', { defaultAnswer: true });
return true;
}
return false;
}
Expand Down Expand Up @@ -304,6 +304,7 @@ async function applySecurityPatches(cli) {

const { owner, repo } = SECURITY_REPO;
const { releaseDate, reports, dependencies } = await fetchVulnerabilitiesDotJSON(cli, req);
const missingPatches = [];

let patchedVersion;
const releaseLine = `${nodeMajorVersion}.x`;
Expand All @@ -316,7 +317,10 @@ async function applySecurityPatches(cli) {

const argv = parsePRFromURL(prURL);
if (argv.owner === SECURITY_REPO.owner && argv.repo === SECURITY_REPO.repo) {
await landingSession(cli, req, prURL, argv);
const skipped = await landingSession(cli, req, prURL, argv);
if (skipped) {
missingPatches.push(`${prURL} (${name} update)`);
}
continue;
}

Expand Down Expand Up @@ -381,7 +385,10 @@ async function applySecurityPatches(cli) {
'once at the start of the session; to refresh those, start a new NCU session');
const response = await cli.prompt('Do you want to skip that CVE?',
{ defaultAnswer: false });
if (response) continue;
if (response) {
missingPatches.push(`${prURL} (${title})`);
continue;
}
throw new Error(`Found no patch for ${cveIds}`);
}
}
Expand All @@ -390,9 +397,17 @@ async function applySecurityPatches(cli) {

const backport = prURL !== pr.url;

await landingSession(cli, req, prURL, { prid: pr.number, backport, ...SECURITY_REPO }, cveIds);
const skipped = await landingSession(
cli, req, prURL, { prid: pr.number, backport, ...SECURITY_REPO }, cveIds);
if (skipped) missingPatches.push(prURL);
}
if (missingPatches.length) {
cli.warn(`The following are missing on the current HEAD:\n${
missingPatches.map(cve => ` - ${cve}`).join('\n')}`);
cli.setExitCode(1);
} else {
cli.ok('All patches are on the local HEAD!');
}
cli.ok('All patches are on the local HEAD!');
cli.info('You can now build and test, and create a proposal with the following commands:');
cli.info(`git switch -C v${nodeMajorVersion}.x HEAD`);
cli.info(`git node release --prepare --security --newVersion=${patchedVersion} ` +
Expand Down
Loading