`npm audit signatures` does not report how many packages it skipped for want of registry keys
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 70/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, nodejs
Direzione di ricerca
Esamina l'implementazione del comando audit signatures, probabilmente in lib/commands/audit-signatures.js o in un modulo di audit simile. Trova dove viene tracciato auditedWithKeysCount e dove viene generato l'output del riepilogo. La modifica prevede l'aggiunta di un conteggio skipped all'output, utilizzando i dati di risoluzione del registro già disponibili. Testa configurando un registro locale senza chiavi e verificando che appaia il nuovo messaggio.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Current behaviour
When a registry does not publish signing keys, audit signatures skips the packages installed
from it. That part is intended — #5479 asked for E400 to be treated like E404 for exactly
this reason, and the summary counts only what was checked, through auditedWithKeysCount.
What the summary does not say is how much was skipped. In a tree where some dependencies resolve
from a registry with keys and some from a registry without, the output and the exit code are
indistinguishable from a tree that was fully verified.
Reproduced on npm 10.9.8 with a local registry that answers 404 on /-/npm/v1/keys:
$ cat package.json
{ "name":"mixed-test","version":"1.0.0",
"dependencies":{ "@nl/nokeys-dep":"1.0.0", "lodash":"4.17.21" } }
$ cat .npmrc
@nl:registry=http://127.0.0.1:8899
$ npm audit signatures
audited 1 package in 0s
1 package has a verified registry signature
$ echo $?
0
@nl/nokeys-dep is in the tree and carries no signature. It is not in the audited count, not
under missing, not under invalid. Nothing in the output indicates it exists.
When nothing can be audited the command already does the right thing:
$ npm audit signatures
npm error found no dependencies to audit that were installed from a supported registry
$ echo $?
1
Why it matters
A pipeline that runs npm audit signatures and branches on the exit code is asking "is this tree
verified". In the mixed case it is told yes, when the honest answer is "the part of it that could
be checked". The configuration where this arises — part of the tree resolving through an internal
mirror, a proxy or a third-party registry that does not publish keys — is a common one, and
arguably the one where the gate matters most.
The tree's total is not printed next to the audited count, so the two cannot be compared without
counting the lockfile separately.
Suggested change
Report the skipped count. Something like:
audited 1 package in 0s
1 package skipped: no signing keys published by http://127.0.0.1:8899
1 package has a verified registry signature
The information is already in hand at that point — the edges walked, the registries resolved and
auditedWithKeysCount — so this is a reporting change rather than a behavioural one. Whether a
skipped package should also affect the exit code is a separate decision, and a flag along the
lines of --require-signatures would leave the current default alone.
I am not suggesting the skip itself should change.
- Lingua principale
- JavaScript
- Stelle
- 10.2k
- Fork
- 4.8k
- Merge medio
- 3g 21h
- PR unite (30g)
- 12
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di npm/cli
-
[BUG] v12.2.0 shipped a stale bundled lockfile after in-range security fixes were already publishedForse già presa @reggi l’ha presa 6 giorni fa. ApertaPriority 1
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
npm/cli#10062 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
create node pr: Node.js 20 deprecation & `DEP0040` warnings loggedForse già presa @lazerg l’ha presa 18 giorni fa. ApertaPriority 1
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
I maintainer di solito rispondono entro 1 giorno
-
Engineering Priority 2
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] E401 error message does not use the configured registryForse già presa @toufiq-dev l’ha presa 18 giorni fa. ApertaBug Priority 3
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
[DOCS] Clarify whether `os`, `cpu`, and `libc` accept a string or must be an arrayForse già presa @SatvikMishra08 l’ha presa 15 giorni fa. ApertaDocumentation Priority 2
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
enhancement
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
holepunchto/hrpc-test#28 ·
-
good first issue
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
anoopcodehack/DevBoard#616 ·
I maintainer di solito rispondono entro 2 giorni
-
idnits3
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
ietf-tools/idnits#319 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
521xueweihan/HelloGitHub#3939 ·