Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(npm)!: drop transitiveRemediation option #27985

Merged
merged 6 commits into from
Apr 14, 2024

Conversation

rarkins
Copy link
Collaborator

@rarkins rarkins commented Mar 18, 2024

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
23 tasks
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.
Co-authored-by: Rhys Arkins <[email protected]>
Co-authored-by: Sebastian Poxhofer <[email protected]>
docs/usage/self-hosted-experimental.md Outdated Show resolved Hide resolved
lib/modules/manager/pep621/extract.spec.ts Outdated Show resolved Hide resolved
@rarkins rarkins requested a review from secustor April 14, 2024 07:48
@rarkins rarkins merged commit 0681648 into v38 Apr 14, 2024
34 checks passed
@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
Copy link
Collaborator

RahulGautamSingh commented May 1, 2024

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
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
Copy link
Collaborator Author

rarkins commented May 2, 2024

@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
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