feat(yarn): write npmPreapprovedPackages entries for security updates
#45279
Closed
MorrisonCole
started this conversation in
Suggest an Idea
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Tell us more.
Split out from #45177 - this one covers Yarn only, and that discussion now covers npm.
TL;DR: Yarn equivalent of the pnpm work in #39168.
Context
Yarn 4.10.0 added
npmPreapprovedPackages(yarnpkg/berry#6901), the counterpart to pnpm'sminimumReleaseAgeExclude. Both the gate and the exclusions live in.yarnrc.yml:It accepts full descriptors with semver ranges as well as name globs, so Renovate can write the same version-scoped entries it already writes for pnpm.
Why this is needed
Yarn applies the age gate when it resolves a package, not when it installs from the lockfile. So
yarn install --immutableis fine after a Renovate security update merges - the problem is the next thing that re-resolves (yarn add, etc.).Verified on Yarn
4.18.0, with a security fix already locked:yarn install --immutable, cold cacheyarn add, range permits an older versionpackage.jsonrewritten to the downgraded rangeyarn add, range pins the fixYN0016: All versions satisfying "x" are quarantinednpmPreapprovedPackagesentry presentSo weeks after a security fix lands, a developer running
yarn add <pkg>either hits a hard error they have to work around by hand, or worse, silently reverts the fix with no warning.An entry written by Renovate alongside the upgrade is what records "this specific version is approved" in the repo so neither happens.
Proposal
npmMinimalAgeGateis set in.yarnrc.ymlnpmPreapprovedPackages, appending thename@versiondescriptor for the upgrade, optionally with a comment marking it as a Renovate-issued security upgradeAll reactions