VerteDinde

#51293: build: restrict npm tarball contents to an explicit allowlist

Merged
Created: Apr 23, 2026, 12:32:15 PM
Merged: Apr 23, 2026, 9:14:08 PM
6 comments
Target: main

Description of Change

The npm publish flow (script/release/bin/publish-to-npm.ts:158) runs npm pack in a staging temp dir, but npm/package.json had no files field — so npm pack included everything it found. In the release environment, two unintended files ended up in that dir before pack ran:

  • .npm-cache/_logs/*-debug-0.log — npm's own debug log, written self-referentially into the pack directory before pack finishes reading files
  • SHASUMS256.txt — the raw release shasum file (~7.6 kB), which duplicates the info in checksums.json

Both leaked into recent electron tarballs (41.2.1+, 40.9.1+, 39.8.8+; 41.2.0 and earlier patches are clean). The contamination source appears to live in the release-automation infrastructure rather than this repo, but an explicit files allowlist in the template package.json keeps the tarball clean regardless of what else lands in the staging dir.

Verified locally by populating a staging dir with .npm-cache/_logs/fake.log + SHASUMS256.txt and running npm pack — with the allowlist in place, the tarball matches the last-clean v41.2.0 layout (9 files, down from 11).

Fixes #51290.

Checklist

  • I have built and tested this change
  • I have filled out the PR description

Release Notes

Notes: none

Backports

39-x-y
Merged
PR Number
#51307
Merged At
Apr 24, 2026, 8:10:21 AM
Released In
Not yet
Release Date
Not yet
40-x-y
Merged
PR Number
#51306
Merged At
Apr 24, 2026, 8:11:13 AM
Released In
Not yet
Release Date
Not yet
41-x-y
Merged
PR Number
#51305
Merged At
Apr 24, 2026, 8:05:23 AM
Released In
Not yet
Release Date
Not yet
42-x-y
Merged
PR Number
#51308
Merged At
Apr 24, 2026, 9:42:57 AM
Released In
Not yet
Release Date
Not yet

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron