--source passes --make, --jobs and --load-average to the shell unquoted
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- node.js, python
- Ambito
- build-system, security
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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 INJECTEDin~/.nodeenvrcrunsecho INJECTEDafter 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
- Lingua principale
- Python
- Stelle
- 1.8k
- Fork
- 225
- Merge medio
- 17h 18m
- PR unite (30g)
- 26
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 ekalinin/nodeenv
-
README config example breaks when copied into ~/.nodeenvrcForse già presa @jihtsan l’ha presa 10 giorni fa. Apertadocs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
activate.fish erases a pre-existing NODE_PATH and never restores itForse già presa @jihtsan l’ha presa 10 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 50/100
I maintainer di solito rispondono entro 1 giorno
-
--source: the tmpbin python -> python2 link breaks in several setupsForse già presa @jihtsan l’ha presa 7 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
ekalinin/nodeenv#416 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ekalinin/nodeenv
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
MISP/misp-workbench#496 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
fossasia/visdom-dev#69 ·
I maintainer di solito rispondono entro 3 giorni
-
[Bug] Parameters named like a property break to_xcal()Forse già presa @atharvasalunke1267 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
collective/icalendar#2018 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno