wizard: installPackage passes unquoted package specs through spawn(..., { shell: true })
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- nodejs, typescript
- Ambito
- cli
Direzione di ricerca
Start with installPackage in packages/cli/src/lib/wizard/utils/clack/index.ts (around line 512), where spawn(pkgManager.name, installArgs, { shell: true }) joins arguments into one shell command line. Remove shell: true and pass argv directly, resolving the .cmd shim on Windows. Done when specs containing >, ^ and | reach the package manager intact, and a test using a fake package-manager binary that records its argv passes.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
installPackage in packages/cli/src/lib/wizard/utils/clack/index.ts (around line 512) runs the package manager with spawn(pkgManager.name, installArgs, { shell: true }), and it doesn't quote the arguments. Node concatenates them into one shell command line, so any shell metacharacter in a package spec gets parsed by the shell:
>and<become redirects. A spec ofsentry@>=0.52.0ran as<pm> add sentry@ -D(it installedlatestwith no version floor) and wrote the command's output to a file named=0.52.0in the project.|becomes a pipe.^is the escape character in Windowscmd, so caret ranges likepkg@^1.2.3can be mangled there.
Node also prints DEP0190 for this pattern: passing args with shell: true concatenates them without escaping.
Nothing user-controlled reaches this today, because every package spec the wizard installs is a constant. getsentry/toolkit#2525 works around it by installing sentry@<major>.x, which has no metacharacters. That workaround only holds while every spec stays free of shell syntax.
Proposal
- Drop
shell: trueand pass argv directly. On Windows, resolve<pm>.cmd(npm.cmd,pnpm.cmd,yarn.cmd, and so on) so it still launches without a shell. - Add a test that exercises
installPackage's argv handling end to end, with a fake package-manager binary that records its argv instead of a mock ofinstallPackage, including a spec with>,^and|.
Related: getsentry/toolkit#1385 covers the same shell: true pattern in sentry init's local-ops.ts.
via @BYK.
--
- Lingua principale
- TypeScript
- Stelle
- 975
- Fork
- 189
- Merge medio
- 19h 57m
- PR unite (30g)
- 542
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 getsentry/toolkit
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
getsentry/toolkit#2583 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
getsentry/toolkit#2531 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
mcp-feedback-pattern
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
getsentry/toolkit#2458 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
getsentry/toolkit#2444 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
mcp-feedback-pattern
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
getsentry/toolkit#2362 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di getsentry/toolkit
Issue simili
-
Release utils decode git output chunk by chunk, so a multi-byte character can turn into U+FFFDForse già presa @goranai l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 2 giorni
-
Task retarget keeps the old host in task scope and adds the new host in a form that matches nothingForse già presa @chaitanya0305 l’ha presa oggi. Apertabug P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
BaaRai/ARTEX#652 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
compiler-explorer/compiler-explorer#9710 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
test(web): RevealArtwork's warm tests flake on CI because a 0 ms idle timeout means no deadlineApertabug effort:S P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
nightscout/nocturne#4556 ·
I maintainer di solito rispondono entro 1 giorno