Skip to content

feat(npm)!: drop transitiveRemediation option - #27985

Merged
rarkins merged 6 commits into
v38from
feat/remove-transitive-remediation
Apr 14, 2024
Merged

rarkins merged 6 commits into
v38from
feat/remove-transitive-remediation

Conversation

@rarkins

@rarkins rarkins commented Mar 18, 2024

Copy link
Copy Markdown
Contributor

Changes

Remove transitiveRemediation option, as it only works for deprecated npm versions.

BREAKING CHANGE: transitiveRemediation option is removed, will now be ignored.

Context

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@viceice viceice added the breaking Breaking change, requires major version bump label Mar 18, 2024
@viceice viceice mentioned this pull request Mar 18, 2024
16 of 23 tasks
@rarkins
rarkins force-pushed the v38 branch 2 times, most recently from 2e26bda to 2da2fde Compare April 13, 2024 08:53
rarkins and others added 3 commits April 14, 2024 09:27
Previously, config from globalExtends was incorrectly merged _after_ other global config. This meant for example that packageRules in a config.js could not override packageRules from within globalExtends, because they were applied after. Now, globalExtends content will be merged first, and remaining global config merged second.

Fixes #28131

BREAKING CHANGE: order of globalExtends resolution is changed so that it is applied first and remaining global config takes precedence.
â€Ķt groups (#28193)

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
@rarkins
rarkins force-pushed the v38 branch 3 times, most recently from fdc9cbb to 6717725 Compare April 14, 2024 07:37
@rarkins
rarkins requested review from secustor and viceice April 14, 2024 07:38
Comment thread docs/usage/self-hosted-experimental.md Resolved
@rarkins
rarkins requested a review from secustor April 14, 2024 07:48
@rarkins
rarkins merged this pull request into v38 Apr 14, 2024
@rarkins
rarkins deleted the feat/remove-transitive-remediation branch April 14, 2024 08:38
rarkins added a commit that referenced this pull request Apr 14, 2024
This option only worked for npm <7, which is now EOL.

BREAKING CHANGE: Transitive remediation for npm <7 is no longer supported.
rarkins added a commit that referenced this pull request Apr 20, 2024
This option only worked for npm <7, which is now EOL.

BREAKING CHANGE: Transitive remediation for npm <7 is no longer supported.
rarkins added a commit that referenced this pull request Apr 21, 2024
This option only worked for npm <7, which is now EOL.

BREAKING CHANGE: Transitive remediation for npm <7 is no longer supported.
rarkins added a commit that referenced this pull request Apr 21, 2024
This option only worked for npm <7, which is now EOL.

BREAKING CHANGE: Transitive remediation for npm <7 is no longer supported.
rarkins added a commit that referenced this pull request Apr 22, 2024
This option only worked for npm <7, which is now EOL.

BREAKING CHANGE: Transitive remediation for npm <7 is no longer supported.
rarkins added a commit that referenced this pull request Apr 26, 2024
This option only worked for npm <7, which is now EOL.

BREAKING CHANGE: Transitive remediation for npm <7 is no longer supported.
rarkins added a commit that referenced this pull request Apr 29, 2024
This option only worked for npm <7, which is now EOL.

BREAKING CHANGE: Transitive remediation for npm <7 is no longer supported.
@RahulGautamSingh

RahulGautamSingh commented May 1, 2024 •

Copy link
Copy Markdown
Collaborator

I think we should also remove the follow code-blocks as they are related to transitiveRemediation only.

} else if (upgrade.isRemediation) {
const { status, files } = await updateLockedDependency({
...upgrade,
depName,
newVersion,
currentVersion,
packageFile,
packageFileContent: packageFileContent!,
lockFile,
lockFileContent: lockFileContent!,
allowParentUpdates: true,
allowHigherOrRemoved: true,
});
if (reuseExistingBranch && status !== 'already-updated') {
logger.debug(
{ lockFile, depName, status },
'Need to retry branch as it is not already up-to-date',
);
return getUpdatedPackageFiles({
...config,
reuseExistingBranch: false,
});
}
if (files) {
updatedFileContents = { ...updatedFileContents, ...files };
Object.keys(files).forEach(
(file) => delete nonUpdatedFileContents[file],
);
}
if (status === 'update-failed' || status === 'unsupported') {
upgrade.remediationNotPossible = true;
}

if (get(manager, 'updateLockedDependency')) {
for (const lockFile of packageFileConfig.lockFiles || []) {
const lockfileRemediations = config.remediations as Record<
string,
Record<string, any>[]
>;
const remediations = lockfileRemediations?.[lockFile];
if (remediations) {
for (const remediation of remediations) {
let updateConfig = mergeChildConfig(
packageFileConfig,
remediation,
);
updateConfig = mergeChildConfig(
updateConfig,
config.vulnerabilityAlerts,
);
delete updateConfig.vulnerabilityAlerts;
updateConfig.isVulnerabilityAlert = true;
updateConfig.isRemediation = true;
updateConfig.lockFile = lockFile;
updateConfig.currentValue = updateConfig.currentVersion;
updateConfig.newValue = updateConfig.newVersion;
updateConfig = applyUpdateConfig(updateConfig);
updateConfig.enabled = true;
updates.push(updateConfig);
}
}
}
}
}
}

@SchroederSteffen

Copy link
Copy Markdown
Contributor

Could you please comment on the reason for the removal?
Like "no capacity to implement it for up-to-date NPM versions" or something like that?

@rarkins

rarkins commented May 2, 2024

Copy link
Copy Markdown
Contributor Author

@SchroederSteffen essentially that's it. It was designed at the time for the npm v1 lock file. npm underwent some pretty big rewrites around the time of the v2 lock file, and some missing/changed capabilities in npm meant that we couldn't use some of the same tricks for updating lock files so v2 wasn't able to be immediately done. Years have passed and there hasn't been any contribution or interest in improving it from the community, either in npm or other managers, and now we're left with a feature which only works with a deprecated version of npm

@SchroederSteffen

Copy link
Copy Markdown
Contributor

Thanks for the detailed response!
Still, I think it's really unfortunate that Renovate doesn't support such transitive remediations, as most vulnerabilities affect transient and not direct dependencies. (I'm currently not able to contribute it myself, though.)

rarkins added a commit that referenced this pull request May 3, 2024
This option only worked for npm <7, which is now EOL.

BREAKING CHANGE: Transitive remediation for npm <7 is no longer supported.
rarkins added a commit that referenced this pull request May 4, 2024
This option only worked for npm <7, which is now EOL.

BREAKING CHANGE: Transitive remediation for npm <7 is no longer supported.
rarkins added a commit that referenced this pull request May 5, 2024
This option only worked for npm <7, which is now EOL.

BREAKING CHANGE: Transitive remediation for npm <7 is no longer supported.
rarkins added a commit that referenced this pull request May 6, 2024
This option only worked for npm <7, which is now EOL.

BREAKING CHANGE: Transitive remediation for npm <7 is no longer supported.
rarkins added a commit that referenced this pull request May 11, 2024
This option only worked for npm <7, which is now EOL.

BREAKING CHANGE: Transitive remediation for npm <7 is no longer supported.
rarkins added a commit that referenced this pull request May 19, 2024
This option only worked for npm <7, which is now EOL.

BREAKING CHANGE: Transitive remediation for npm <7 is no longer supported.
rarkins added a commit that referenced this pull request May 31, 2024
This option only worked for npm <7, which is now EOL.

BREAKING CHANGE: Transitive remediation for npm <7 is no longer supported.
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

breaking Breaking change, requires major version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants