--source passes --make, --jobs and --load-average to the shell unquoted
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- node.js, python
- 領域
- build-system, security
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Python
- スター
- 1.8k
- フォーク
- 225
- 平均マージ
- 17時間 18分
- マージ済み PR(30日)
- 26
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ekalinin/nodeenv のほかの issue
-
README config example breaks when copied into ~/.nodeenvrc対応中かも @jihtsan が 10 日前に担当しました。 オープンdocs
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
activate.fish erases a pre-existing NODE_PATH and never restores it対応中かも @jihtsan が 10 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 50/100
メンテナーはふだん 1 日以内に返信
-
--source: the tmpbin python -> python2 link breaks in several setups対応中かも @jihtsan が 7 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
ekalinin/nodeenv#416 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
ekalinin/nodeenv の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
gramaziokohler/compas_timber#870 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
autowarefoundation/autoware_carla_scenario#500 ·
メンテナーはふだん 1 日以内に返信
-
good first issue priority: low size: XS testing
難易度 1/5 1〜3時間 初心者へのやさしさ 86/100
cubrid-lab/cubrid-mcp-server#385 ·
メンテナーはふだん 1 日以内に返信
-
good first issue priority: low size: S testing
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
cubrid-lab/cubrid-cookbook-python#447 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100