Skip to content

fix(pnpm): preserve package names in lockfile scans - #1796

Merged
John-David Dalton (jdalton) merged 1 commit into
v1.xfrom
fix/1489-preserve-pnpm-package-names
Dec 2, 2026
Merged

John-David Dalton (jdalton) merged 1 commit into
v1.xfrom
fix/1489-preserve-pnpm-package-names

Conversation

@jdalton

@jdalton John-David Dalton (jdalton) commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Socket preserves underscores in package names when scanning pnpm lockfiles. This prevents the scanner from checking an unrelated package or blocking an install on the wrong alert. Peer suffixes are stripped from the version portion of each lockfile entry.

Fixes #1489

@cursor

cursor Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes how npm PURLs are derived for Socket lockfile scans; mis-parsing could previously target the wrong package for alerts, though the change is narrowly scoped to dep-path parsing.

Overview
PURL extraction from pnpm lockfiles now strips peer suffixes only from the version segment, so underscores in package names (e.g. my_package) are no longer treated as peer metadata.

extractPurlsFromPnpmLockfile routes dep paths through a new stripPnpmPeerSuffixFromDepPath helper that locates the name@version boundary (including scoped @scope/pkg), applies the existing peer-stripping logic to the version only, and normalizes legacy name/version lockfile keys when the version is valid semver.

A dedicated test locks in expected PURLs for modern @ paths, peer _/parenthesis suffixes, legacy slash-style keys, and versionless entries.

Reviewed by Cursor Bugbot for commit bea0954. Configure here.

@jdalton John-David Dalton (jdalton) changed the title Preserve package names in pnpm lockfile scans fix(pnpm): preserve package names in lockfile scans Dec 2, 2026
@jdalton
John-David Dalton (jdalton) force-pushed the fix/1489-preserve-pnpm-package-names branch from 3ae473b to 705c100 Compare December 2, 2026 00:49
@jdalton
John-David Dalton (jdalton) force-pushed the fix/1489-preserve-pnpm-package-names branch from 705c100 to f553a7d Compare December 2, 2026 00:56
@jdalton
John-David Dalton (jdalton) merged commit 43d7667 into v1.x Dec 2, 2026
25 of 36 checks passed
@jdalton
John-David Dalton (jdalton) deleted the fix/1489-preserve-pnpm-package-names branch December 2, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

socket pnpm install fabricates alerts for packages not in the tree: pnpm v9 lockfile keys are truncated at the first underscore

2 participants