Skip to content

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

Merged
codebytere merged 2 commits into40-x-yfrom
trop/40-x-y-bp-build-restrict-npm-tarball-contents-to-an-explicit-allowlist-1776996859138
Apr 24, 2026
Merged

build: restrict npm tarball contents to an explicit allowlist#51306
codebytere merged 2 commits into40-x-yfrom
trop/40-x-y-bp-build-restrict-npm-tarball-contents-to-an-explicit-allowlist-1776996859138

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:14
@trop trop Bot added 40-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Apr 24, 2026
@codebytere codebytere enabled auto-merge (squash) April 24, 2026 12:53
@codebytere codebytere merged commit 8516b8b into 40-x-y Apr 24, 2026
121 of 122 checks passed
@codebytere codebytere deleted the trop/40-x-y-bp-build-restrict-npm-tarball-contents-to-an-explicit-allowlist-1776996859138 branch April 24, 2026 13:11
@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

40-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.

1 participant