Application.load_config_file loads all files with same basename as given file
まだ誰も着手していません。
評価
調査の方向性
Application.load_config_file から始め、テンポラリの .py ファイルと .json ファイルを使って issue の 2 つのケースを再現します。要求されたパスがどのように解決され、一致するファイルがどのように選択されるかを追跡します。絶対パスを 1 つ読み込んだときに、同じベース名を持つ別のファイルが実行も解析もされないことを示す回帰テストを追加します。
索引モデルが issue の本文から書いたものです。
説明
Even if load_config_file is given an absolute path to a config file, it will load all files that have the same basename that are in that directory.
This is highly surprising and potentially a security issue.
Example:
from pathlib import Path
from traitlets import Integer
from traitlets.config import Application
from tempfile import TemporaryDirectory
class Foo(Application):
bar = Integer(0).tag(config=True)
def start(self):
print(self.bar)
if __name__ == "__main__":
with TemporaryDirectory() as tmpdir:
tmpdir = Path(tmpdir)
json_path = tmpdir / "foo.json"
py_path = tmpdir / "foo.py"
# valid python, invalid
py_path.write_text("c.Foo.bar = 10")
json_path.write_text("Invalid json")
app = Foo()
app.load_config_file(py_path)
app.start()
# other way around
py_path.write_text("raise Exception('You loaded the python file!')")
json_path.write_text('{"Foo": {"bar": 11}}')
app = Foo()
app.load_config_file(json_path)
app.start()
- 主要言語
- Python
- スター
- 653
- フォーク
- 217
- 平均マージ
- 2日 21時間
- マージ済み PR(30日)
- 2
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ipython/traitlets のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
-
難易度 1/5 1〜3時間 初心者へのやさしさ 65/100
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
ipython/traitlets の issue をすべて見る
似ている issue
-
area: harness bug status: needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Human-Agent-Society/reef#625 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
learningequality/kolibri#15351 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Name consistency オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
eellak/triplestore#65 · コメント 1 件 ·