Repository navigation
[pull] main from pnpm:main - #471
Merged
Merged
Conversation
…th name (#13596) GHSA-c59q-g84q-2gj5 reported that the isolated linker joined the lockfile-derived package name onto the virtual store without validation. That site, and the PnP `packageLocation`, were already contained by 51300fd; the one recommended site that commit missed is the rebuild phase, which resolves its package root the same way. `_rebuild` reads the current lockfile from `node_modules` and rebuilds `pkgRoot` as `path.join(pkgModulesDir(depPath), pkgInfo.name)`, where `pkgInfo.name` comes from `dp.parse` of the depPath key. `dp.parse` is a raw substring and validates nothing, so a `../../../[email protected]` key pointed the lifecycle-script runner and the post-build bin linking at a directory outside the virtual store. The dep graph that phase walks comes from `@pnpm/deps.graph-hasher`, which deliberately defers the name check to its sink -- and this sink had none. Route both joins through `safeJoinModulesDir`, so a crafted name fails with ERR_PNPM_INVALID_DEPENDENCY_NAME before any script runs. Reachability is narrower than the reported install path: the poisoned lockfile has to already be in `node_modules`, which means a shipped or restored `node_modules` rather than a committed `pnpm-lock.yaml`. No pacquet change: its `rebuild` drives the frozen-install pipeline, which runs `verify_lockfile_dependency_names` unconditionally over snapshot package names, and it reads the project lockfile rather than a copy in `node_modules`, so it has no equivalent unguarded sink.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )