Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

--source passes --make, --jobs and --load-average to the shell unquoted

Abierto
#430 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@jihtsan ya está trabajando en esto.

Desde el 13/10/2026.

  • #432 de @jihtsan — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
node.js, python

Línea de trabajo

Start with build_node_from_src and callit, where the issue shows the make command being passed through the shell; inspect how _quote handles env_dir and review the tests for source builds. Reproduce with a make path containing spaces and a jobs value containing shell syntax. Done means both values are passed as intended and the reproduction no longer splits the path or executes injected shell syntax; pull request #432 is already open.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

build_node_from_src runs the make steps through the shell (callit(..., in_shell=True) joins the list with spaces and calls Popen(..., shell=True)), but only env_dir goes through _quote:

    make_opts = [
        '--{0}={1}'.format(name, value)
        if len(value) > 0 else '--{0}'.format(name)
        for name, value in zip(make_param_names, make_param_values)
        if value is not None
    ]
    ...
    make_cmd = args.make_path

    callit([make_cmd] + make_opts, args.verbose, True, node_src_dir, env)
    ...
    callit([make_cmd + ' install'], args.verbose, True, node_src_dir, env)

make_path comes from --make or make in the [nodeenv] section of ./tox.ini, ./setup.cfg or ~/.nodeenvrc, jobs from --jobs or jobs there, and load_average from --load-average. As a result:

  • a make path with a space is split by the shell: --make '/opt/my tools/make' runs /opt/my
  • shell syntax in these values is executed: jobs = 2; echo INJECTED in ~/.nodeenvrc runs echo INJECTED after make
Reproduce

On master (ecb4b74), with a fake configure and a fake make that prints its arguments:

mkdir -p /tmp/x/node-src '/tmp/x/my tools' /tmp/x/tools
printf '#!/bin/sh\nexit 0\n' > /tmp/x/node-src/configure
printf '#!/bin/sh\necho "make called with: $*"\n' > /tmp/x/tools/make
cp /tmp/x/tools/make '/tmp/x/my tools/make'
chmod +x /tmp/x/node-src/configure /tmp/x/tools/make '/tmp/x/my tools/make'
import types
from unittest import mock
import nodeenv

for make_path, jobs in [('/tmp/x/my tools/make', '2'),
                        ('/tmp/x/tools/make', '2; echo INJECTED')]:
    args = types.SimpleNamespace(load_average=None, jobs=jobs, without_ssl=False,
        debug=False, profile=False, make_path=make_path, verbose=True)
    # pretend python2 exists so the build gets past #419
    with mock.patch.object(nodeenv.shutil, 'which', return_value='/usr/bin/false'):
        try:
            nodeenv.build_node_from_src('/tmp/x/env', '/tmp/x', '/tmp/x/node-src', args)
        except OSError as e:
            print('OSError:', e)

The make path with a space:

/bin/sh: /tmp/x/my: No such file or directory
OSError: Command "/tmp/x/my tools/make" --jobs=2 failed with error code 127

jobs = '2; echo INJECTED':

make called with: --jobs=2
INJECTED
make called with: install
Lenguaje dominante
Python
Estrellas
1.8k
Forks
225
Merge medio
17 h 18 min
PR fusionados (30 d)
26

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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ekalinin/nodeenv

Todos los issues de ekalinin/nodeenv

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.