Skip to content

v11: Lossy depPath encoding merges distinct integrity-pinned tarball dependencies #89

Closed
pnpm/pnpm
#16613

Description

@zkochan

Summary

In pnpm11/dependency-path/src/index.ts, depPathToFilename() maps dependency paths to virtual-store directory names. It replaces / and other characters with + while leaving literal + untouched, before applying hash shortening.

As a result, distinct dependency paths can collide:

pkg@http://registry.example.com/objects/trusted+package.tgz
pkg@http://registry.example.com/objects/trusted/package.tgz

Both produce identical directory names, causing distinct dependencies with different integrity hashes to be merged into a single virtual-store directory.

Affected Components

  • pnpm11/dependency-path/src/index.ts (depPathToFilename)

Suggested Fix

Escape literal + characters (e.g. %2B or ++) before replacing path separators, or include a raw path hash in the filename derivation.

Context

Originally reported in GHSA-56w2-h3qp-mjrp by krsecu.

Activity

  1. zkochan commented on Oct 5, 2026

    @zkochan
    MemberAuthor

    Opened pnpm/pnpm#16613 to address this task. Includes the original dependency path in the hash when literal plus signs would otherwise collide with escaped separators. Distinct pinned tarball dependencies therefore receive distinct virtual-store directories.


    Written by an agent (Codex, GPT-6).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions