We pinned seven transitive dependencies in our desktop app, and not one of them can reach a user
Notifio is an Electron app that watches rental searches and sends you an alert when a new listing appears. You get it from the download page, as a DMG for each Mac architecture or a Windows installer, and the question I
Notifio is an Electron app that watches rental searches and sends you an alert when a new listing appears. You get it from the download page, as a DMG for each Mac architecture or a Windows installer, and the question I wanted to answer after yesterday's dependency commit is the plain one: of the things we just patched, how many are inside that file?
The commit is eight lines in app/pnpm-workspace.yaml:
allowBuilds:
electron-winstaller: true
esbuild: true
overrides:
'@xmldom/xmldom@0': ^0.8.15
brace-expansion@1: ^1.1.21
brace-expansion@2: ^2.1.7
fast-uri@3: ^3.1.9
js-yaml@4: ^4.3.2
tar@7: ^7.5.21
undici@6: ^6.29.1
Seven overrides, six package names. Each one raises the floor of a package we never chose, in a range we never wrote. Here is what each does to the lockfile, taken from git show on the lock before the override commit and after it:
before after
@xmldom/xmldom 0.8.13 0.8.15
brace-expansion 1.1.16 1.1.22
brace-expansion 2.1.2 2.1.8
fast-uri 3.1.4 3.1.9
js-yaml 4.3.0 4.3.2
tar 7.5.20 7.5.24
undici 6.27.0 6.29.1
One thing stands out before any analysis: the selector style. every key is a name plus a major range, which means a package can appear in the lock at a version the override does not touch. brace-expansion is in the lock three times (1.1.22, 2.1.8 and 5.1.0) and the third is unchanged, and undici is in the lock twice (6.29.1 and 7.30.2) with the second unchanged. Seven lines, nine installed versions, two of them outside any override.
The question
Does any of that ship? pnpm why takes a --prod flag that restricts the walk to production dependencies:
cd app
for p in @xmldom/xmldom brace-expansion fast-uri js-yaml tar undici; do
echo "== $p: $(pnpm why $p --prod 2>&1 | tr '\n' ' ')"
done
Every line comes back empty. The app declares six runtime dependencies (dotenv, express, playwright, react, react-dom, tldts) and 14 dev ones. The production tree is 77 entries, the full tree is 469, and none of the six names is in the first.
To check that this is not only pnpm's opinion, I opened the archive electron-builder produced and counted. The app.asar in my latest local Mac build has 2,057 entries and 74 top-level packages under node_modules. None of the six is one of them. That build is from 22 September, well before this commit, so it proves the shape and not the new versions, but the shape is the point: electron-builder prunes the tree to what dependencies reaches, and the overrides sit entirely in the rest.
Who does use them
pnpm why without the flag lists the parents, and they all lead to the same few places:
@xmldom/xmldom plist > @electron/osx-sign, @electron/universal > app-builder-lib
brace-expansion minimatch > @electron/asar, dir-compare, glob@7 > rimraf@2, jake > filelist
fast-uri ajv > app-builder-lib
js-yaml app-builder-lib, builder-util
tar app-builder-lib, node-gyp > @electron/rebuild
undici@6 node-gyp > @electron/rebuild
undici@7 @electron/get > electron
app-builder-lib is electron-builder's engine. @electron/osx-sign, @electron/universal and @electron/rebuild are its Mac signing, universal-binary and native-rebuild helpers. @electron/get is what downloads the Electron binary itself. rimraf is the clean step. This is the toolbox that runs on the machine that builds the installer. Our build.files array even names several of them in its exclude list, as !node_modules/.pnpm/electron-builder*/**/*, !node_modules/.pnpm/app-builder-lib*/**/* and !node_modules/.pnpm/node-gyp*/**/*, because the installer config has to keep a pnpm virtual store from leaking in. The include and exclude globs are a separate story. The consequence here is simply that the seven overrides are patches to code that runs once, on my laptop, when I make a release.
That is not the same as unimportant. A build tool that parses a plist, extracts a tarball or downloads a binary runs on the same machine, and as the same user, as the release script that uploads the installers. A floor on tar is a fair thing to want there.
The same commit, on the server
The matching change in server/pnpm-workspace.yaml is two unscoped overrides, fast-uri: ^3.1.9 and browserslist: ^4.28.7. I ran the same check:
cd server
pnpm why fast-uri --prod
pnpm why browserslist --prod
These are not empty. fast-uri arrives through ajv, schema-utils and webpack, and browserslist through Babel, styled-jsx and next, and also through webpack and the Sentry bundler plugin. The server's dependencies includes next and @sentry/nextjs, so for the server a "transitive override" is closer to a runtime decision, although it executes during next build on the host and not in a visitor's browser.
So one commit made two kinds of change. The server's overrides touch what the production install resolves. The app's touch what the build machine resolves, and they cannot touch the file you download. I only knew which was which because I asked the tree.
What I would take from this
I did not read the advisories behind each version bump one at a time, so I am not going to say what each patch fixes. The commit message says "patched versions" and that is as far as my evidence goes.
What I can say is how to classify an overrides block before deciding how much it matters:
- List the names (
overrideskeys, minus the version selector). -
pnpm why <name> --prodfor each. Empty output means the package is build-time only. - Look at the parents of the non-empty ones. A parent that is a bundler, an image processor or a server framework is your runtime.
- Check the selector.
name@majorleaves other majors alone, and a barenameforces everything to one range, which can break a consumer that needed an older line.
If you ship a desktop app, number 2 is also a decent test of your packaging config: whatever pnpm list --prod prints is what the installer archive should contain, and for us it does (77 entries in the production tree and 74 top-level packages in the archive, which is the same order of size). The installer side of this is written up in what 454 excluded paths leave in, and the download you can try for yourself is at notifio.app/download. If you have questions about what the app does and does not keep on your machine, the help page is the place.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.