Skip to content

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

Merged
jkleinsc merged 2 commits into
42-x-yfrom
trop/42-x-y-bp-build-restrict-npm-tarball-contents-to-an-explicit-allowlist-1776996860966
Apr 24, 2026
Merged

build: restrict npm tarball contents to an explicit allowlist#51308
jkleinsc merged 2 commits into
42-x-yfrom
trop/42-x-y-bp-build-restrict-npm-tarball-contents-to-an-explicit-allowlist-1776996860966

Conversation

@trop
Copy link
Copy Markdown
Contributor

@trop trop Bot commented Apr 24, 2026

Backport of #51293

See that PR for details.

Notes: none

trop Bot and others added 2 commits April 24, 2026 02:14
The npm publish flow runs `npm pack` in a staging temp dir, but
`npm/package.json` had no `files` field — so any file that happened
to land in that dir was packed into the published tarball.

Recent releases (41.2.1+, 40.9.1+, 39.8.8+) shipped a self-referential
`.npm-cache/_logs/*-debug-0.log` (npm's own debug log, written into
the pack dir before pack finishes reading files) and a stray copy of
`SHASUMS256.txt` that duplicates the info already in `checksums.json`.

Add an explicit `files` allowlist so only the intended contents are
packaged, regardless of staging-dir contamination. `package.json`,
`README.md`, and `LICENSE` are auto-included by npm.

Fixes #51290.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
These are auto-included by npm regardless, but listing them makes the
intended contents of the tarball self-documenting alongside the other
entries.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
@trop trop Bot requested a review from a team as a code owner April 24, 2026 02:14
@trop trop Bot requested a review from VerteDinde April 24, 2026 02:15
@trop trop Bot added 42-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Apr 24, 2026
@jkleinsc jkleinsc merged commit ab52a57 into 42-x-y Apr 24, 2026
125 of 128 checks passed
@jkleinsc jkleinsc deleted the trop/42-x-y-bp-build-restrict-npm-tarball-contents-to-an-explicit-allowlist-1776996860966 branch April 24, 2026 14:42
@release-clerk
Copy link
Copy Markdown

release-clerk Bot commented Apr 24, 2026

No Release Notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

42-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants