wizard: installPackage passes unquoted package specs through spawn(..., { shell: true })
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- nodejs, typescript
- Área
- cli
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
--
- Lenguaje dominante
- TypeScript
- Estrellas
- 975
- Forks
- 189
- Merge medio
- 19 h 57 min
- PR fusionados (30 d)
- 542
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de getsentry/toolkit
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
getsentry/toolkit#2583 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
getsentry/toolkit#2531 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
mcp-feedback-pattern
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
getsentry/toolkit#2458 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
getsentry/toolkit#2444 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
mcp-feedback-pattern
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
getsentry/toolkit#2362 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de getsentry/toolkit
Issues similares
-
Release utils decode git output chunk by chunk, so a multi-byte character can turn into U+FFFDPosiblemente ocupada @goranai la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 2 días
-
Task retarget keeps the old host in task scope and adds the new host in a form that matches nothingPosiblemente ocupada @chaitanya0305 la tomó hoy. Abiertobug P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
BaaRai/ARTEX#652 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
compiler-explorer/compiler-explorer#9710 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
test(web): RevealArtwork's warm tests flake on CI because a 0 ms idle timeout means no deadlineAbiertobug effort:S P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
nightscout/nocturne#4556 ·
Los mantenedores suelen responder en 1 día