Skip to content

fix: flatten path separators in pack output filename#9468

Merged
owlstronaut merged 1 commit into
release/v11from
backport/v11/9446
Jun 2, 2026
Merged

fix: flatten path separators in pack output filename#9468
owlstronaut merged 1 commit into
release/v11from
backport/v11/9446

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Jun 2, 2026

Backport of #9446 to release/v11.

`npm pack` writes the tarball to a name built from `manifest.name` with
a non-global `.replace(/\//, '-')`, which only strips the single scope
slash. When packing a remote tarball, git, or directory spec the name
comes from a package.json that the registry never validated, so a name
like `x/../../../escaped` keeps its `../` segments and
`path.resolve(packDestination, filename)` lands the tarball outside the
destination. Make the separator replacement global so the filename is
always one path component.

(cherry picked from commit 76f8059)
@owlstronaut owlstronaut merged commit 33d421a into release/v11 Jun 2, 2026
34 checks passed
@owlstronaut owlstronaut deleted the backport/v11/9446 branch June 2, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants