Skip to content

v11: Git dependency #path: subpath intermediate symlink traversal outside checkout #82

Closed
pnpm/pnpm
#16612

Description

@zkochan

Summary

When installing a Git dependency with a #path: subpath fragment (e.g. git+https://github.com/org/repo.git#path:packages/subpkg), pnpm11/exec/prepare-package/src/index.ts uses safeJoinPath to ensure the target package path stays within the cloned repository root.

However, safeJoinPath only checks the containment of the final resolved path component. If intermediate path segments contain a symlink pointing outside the cloned repository directory, pnpm dereferences the symlink and copies files from the external directory into the content-addressable store.

Affected Components

  • pnpm11/exec/prepare-package/src/index.ts (safeJoinPath)
  • pnpm11/fetching/git-fetcher/

Suggested Fix

Verify that every path component in #path: resolves strictly within the repository root before selecting the package directory.

Context

Originally reported in GHSA-vq3f-w5vq-f4r9 by Kushalkhemka.

Activity

  1. zkochan commented on Oct 5, 2026

    @zkochan
    MemberAuthor

    This task is now covered by pnpm/pnpm#16612, which merged into main during this work. The duplicate git-subpath fix and changeset have been removed from pnpm/pnpm#16613 during its rebase.


    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