[Bug] config unset ignores trailing arguments and removes the saved setting

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

I maintainer di solito rispondono entro 2 giorni

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
nodejs, typescript
Ambito
cli, testing

Direzione di ricerca

Inizia da src/cli/args.ts, in particolare dal parser degli argomenti di configurazione intorno alla riga collegata, ed esamina tests/cli/config-command.test.ts. Attualmente il parser accetta operandi aggiuntivi e flag non supportati; aggiungi controlli mirati per show, set e unset, quindi esegui i test del comando di configurazione per verificare che gli argomenti rifiutati non modifichino la configurazione salvata.

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

Descrizione

bug good first issue

Summary

cve-lite config unset ca-cert --dry-run removes the saved certificate path and exits 0. The CLI accepts the unsupported option silently, so a user trying to preview the command ends up changing their configuration.

Environment

CVE Lite CLI 1.44.0, upstream main at a47a1cd. macOS 27.2.1, Node.js v24.19.0, npm 11.17.0. The config commands do not require a lockfile.

Reproduction and command used

Run from a built checkout (npm ci && npm run build). The small Node preload points the CLI at a disposable config directory.

tmp=$(mktemp -d)
cat > "$tmp/config-home.cjs" <<'JS'
require('node:os').homedir = () => __dirname;
JS
config() { node --require "$tmp/config-home.cjs" dist/index.js config "$@"; }
config set ca-cert tests/fixtures/tls/osv-test-cert.pem
config unset ca-cert --dry-run
echo "unset exit: $?"
config show
config show unexpected
echo "show exit: $?"

Actual behavior

unset printed ✔ Removed: ca-cert and exited 0. The following config show printed No configuration set. The read-only command config show unexpected also exited 0.

Expected behavior

Reject the first unexpected argument with a nonzero exit before applying the command. After the rejected unset, config show should still list the certificate. The supported config unset ca-cert should continue to remove it.

Where to look

The config argument parser returns as soon as it has the required operands for show, set, or unset. A focused regression test can check extra operands and flags for those three forms. Config parser · Config command tests

Lingua principale
TypeScript
Stelle
806
Fork
209
Merge medio
3g 19h
PR unite (30g)
138

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 OWASP/cve-lite-cli

Tutte le issue di OWASP/cve-lite-cli

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.