wizard: installPackage passes unquoted package specs through spawn(..., { shell: true })
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 55/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- nodejs, typescript
- Bereich
- cli
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
--
- Vorherrschende Sprache
- TypeScript
- Sterne
- 975
- Forks
- 189
- Ø Merge
- 19 Std. 57 Min.
- Gemergte PRs (30 T.)
- 542
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus getsentry/toolkit
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
getsentry/toolkit#2583 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
getsentry/toolkit#2531 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
mcp-feedback-pattern
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
getsentry/toolkit#2458 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
getsentry/toolkit#2444 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
mcp-feedback-pattern
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
getsentry/toolkit#2362 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in getsentry/toolkit
Ähnliche Issues
-
Release utils decode git output chunk by chunk, so a multi-byte character can turn into U+FFFDEvtl. vergeben @goranai hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
Maintainer antworten meist innerhalb von 2 Tagen
-
Task retarget keeps the old host in task scope and adds the new host in a form that matches nothingEvtl. vergeben @chaitanya0305 hat das heute übernommen. Offenbug P2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
BaaRai/ARTEX#652 · 1 Kommentar · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
compiler-explorer/compiler-explorer#9710 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
test(web): RevealArtwork's warm tests flake on CI because a 0 ms idle timeout means no deadlineOffenbug effort:S P3
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
nightscout/nocturne#4556 ·
Maintainer antworten meist innerhalb von 1 Tag