Skip to content

fix(shadow): scan the target of npm aliases - #1795

Merged
John-David Dalton (jdalton) merged 1 commit into
v1.xfrom
fix/1655-scan-alias-target
Dec 2, 2026
Merged

John-David Dalton (jdalton) merged 1 commit into
v1.xfrom
fix/1655-scan-alias-target

Conversation

@jdalton

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

Copy link
Copy Markdown
Contributor

Socket’s pnpm and Yarn wrappers now scan the package an npm alias installs. The package lookup uses the alias target’s name and version.

Fixes #1655

@cursor

cursor Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes package identity used for alert scanning on alias installs; incorrect parsing would miss or mis-attribute risk checks, but scope is limited to npm spec handling with new tests.

Overview
npm alias installs are now resolved to the underlying package instead of the alias name when building PURLs for security scans.

safeParseNpmSpec and safeNpmSpecToPurl in npm-spec.mts detect alias results from npm-package-arg and read name/version from subSpec, so wrappers like scanPackagesAndLogAlerts look up pkg:npm/real-package@… for specs such as alias@npm:real-package@1.2.3.

Tests cover alias parsing (scoped targets, tags, ranges, *) and assert the shadow add path passes the target PURL into alert lookup.

Reviewed by Cursor Bugbot for commit 16f3818. Configure here.

@jdalton John-David Dalton (jdalton) changed the title Scan the target package for npm aliases fix(shadow): scan the target of npm aliases Dec 2, 2026
Assisted-by: Codex:GPT-6-Luna
@jdalton
John-David Dalton (jdalton) merged commit addfe9d into v1.x Dec 2, 2026
23 checks passed
@jdalton
John-David Dalton (jdalton) deleted the fix/1655-scan-alias-target 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 add / socket yarn add scan the alias name instead of the aliased package

2 participants