Dev.to Security 🔐 Cybersecurity 👁 2 📖 3 min read

One dependency bump took our audit from 130 advisories to 7, and only one of its four pnpm overrides does anything on a fresh install

On 30 November the CogniPrep app took one commit to bump its dependencies and pin four pnpm overrides. The diff is 2,514 insertions and 3,879 deletions, nearly all of it pnpm-lock.yaml. The lockfile went from 882 package

On 30 November the CogniPrep app took one commit to bump its dependencies and pin four pnpm overrides. The diff is 2,514 insertions and 3,879 deletions, nearly all of it pnpm-lock.yaml. The lockfile went from 882 packages to 752. Forty-four dependency version lines changed in package.json, plus two script pins for the job runner CLI, and Next.js went from 16.2.4 to 16.4.6.

The commit adds this to pnpm-workspace.yaml:

# Security floors for transitive deps whose parents pin vulnerable versions.
overrides:
  browserslist: ^4.28.7
  effect: ^3.22.1
  fast-uri: ^3.1.9
  vite: ^8.1.6

The comment says the parents pin vulnerable versions. I wanted to know whether that is true for each of the four, so I ran the experiment instead of trusting the comment.

The audit, before and after

pnpm audit against the lockfile as it was before the commit, run today, reports 130 advisories across 32 packages: 16 low, 56 moderate, 50 high and 8 critical. Against the lockfile as committed, it reports 7. Limited to production dependencies, 119 became 5.

Where the 130 were: 38 in Next.js alone, 14 in a mail library, 12 in fast-uri, 8 in an XML parser, and 58 spread over the other 28 packages. The four override targets account for 20 of the 130 (12 fast-uri, 5 vite, 2 browserslist, 1 effect), and the other 110 sit in other packages. Remember the audit database moves: these numbers are for 2 December, not for the day the lockfile was written.

I am deliberately not listing the 7 that remain.

The experiment

Same package.json as the commit, pnpm-workspace.yaml with the overrides: block removed, and pnpm install --lockfile-only --ignore-scripts so nothing is installed. Two runs, pnpm 11.18:

A. Old lockfile in place. This is a stale lock meeting a newer manifest, which is what a long-lived branch looks like.

Package Resolved
browserslist 4.28.6 (below the floor)
effect 3.21.0 (below the floor)
fast-uri 3.1.3 (below the floor)
vite 8.1.5 (below the floor)

Nothing moved. pnpm keeps a locked transitive version for as long as its range is satisfied, and every one of these ranges was. So on an existing lockfile, all four overrides do their job, because without them none of the four would have been touched.

B. No lockfile. This is a fresh clone.

Package Resolved At or above floor?
browserslist 4.29.6 yes
effect 3.21.0 no
fast-uri 3.1.9 yes
vite 8.4.0 yes

Three of the four reach their floor with no help. The ranges the parents ask for are open (^4.24.0 for browserslist, ^3.0.1 for fast-uri, ^6 || ^7 || ^8 for vite), so a fresh resolve takes the newest match. Only effect stays behind.

The one that is load-bearing

pnpm why effect prints a single chain: our dev-dependency on the job runner's build package, then Prisma's config package, then effect. That config package asks for effect at exactly 3.21.0, no range. A pin cannot be satisfied by a newer release, so only an override can move it. Strip the override and a clean install gives you 3.21.0 again, with its advisory.

It is also a dev-only chain. Nothing in it ships to the browser or to the server runtime. That does not make the advisory unimportant on a build machine, but it changes how urgent it is, and it is the kind of fact you only get from pnpm why.

What the comment should say

"Security floors for transitive deps whose parents pin vulnerable versions" is true of one entry. For the other three, a better comment would be "so a stale lockfile cannot keep an old copy", which is a legitimate reason to keep them. It is also a reason that expires: once every lockfile that matters has been regenerated on top of these versions, those three lines are doing nothing.

I am leaving them in. Four lines cost nothing to carry, and the value of the exercise was knowing which is which.

Caveats

The experiment resolves against the registry as it is today. A newer effect that the parent allows, or a parent that loosens its pin, changes the answer. The audit counts are a snapshot. And I did not bump the packages one at a time, so I cannot say how many of the 130 each part of the commit closed.

See it

There is no public page for a lockfile, so I will not pretend there is. The running result is cogniprep.app, and one thing about it is checkable:

curl -sI -A "Mozilla/5.0" https://cogniprep.app/ | grep -i x-powered-by

It says Next.js, with no version number. If you run your own version of the experiment, the commands are pnpm install --lockfile-only, pnpm why <package> and pnpm audit --json, each on a copy of your project in a scratch directory.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.