Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

socket pnpm add / socket yarn add scan the alias name instead of the aliased package

Aperta Adatta ai principianti
#1,655 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
85/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript
Ambito
cli, security

Direzione di ricerca

Leggi src/utils/npm-spec.mts e la funzione safeParseNpmSpec; manca di un ramo alias e usa il risultato di npm-package-arg. Aggiungi la gestione per il tipo 'alias' usando subSpec per restituire il pacchetto e la versione reali. Verifica con SOCKET_CLI_DEBUG=1 socket pnpm add my-lodash@npm:[email protected] che pkg:npm/[email protected] viene inviato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The shadow pnpm and yarn wrappers check packages with the Socket API before they install them. For an npm alias spec, the check looks up the alias name instead of the package that gets installed.

safeParseNpmSpec in src/utils/npm-spec.mts reads name and version from the npm-package-arg result. For an alias, npm-package-arg returns type: 'alias', sets name to the alias, and puts the real package in subSpec. The function has no branch for alias, so it returns the alias name with no version.

Command argument PURL sent for scanning Package installed
my-lodash@npm:[email protected] pkg:npm/my-lodash [email protected]
node-types@npm:@types/[email protected] pkg:npm/node-types @types/[email protected]

As a result, the installed package never gets checked. If an unrelated package has the alias name, its alerts are reported instead. socket yarn install has the same problem with aliased package.json dependencies such as "my-lodash": "npm:lodash@^4", because it builds name@version from each entry and passes the result to the same function.

Steps to reproduce

  1. Run SOCKET_CLI_DEBUG=1 socket pnpm add my-lodash@npm:[email protected].
  2. Check the packagePurls debug output.

Expected result

pkg:npm/[email protected]

Actual result

pkg:npm/my-lodash

Version

v1.x branch at 766b1e6 / [email protected].

Lingua principale
TypeScript
Stelle
336
Fork
72
Merge medio
8h 18m
PR unite (30g)
70

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SocketDev/socket-cli

Tutte le issue di SocketDev/socket-cli

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.