pip gets the package in place of its metadata through a pull-through link once the package is cached
メンテナーはふだん 2 日以内に返信
評価
調査の方向性
Read the linked pull request #1454, which follows this report. The issue identifies Distribution.content_handler() and PythonRemote.get_remote_artifact_url() as relevant entry points; understand how pull-through links announce PEP 658 metadata and how the proposed change handles them. Done means pip no longer receives a package where it expects metadata after the package has been cached.
索引モデルが issue の本文から書いたものです。
説明
Version
pulp_python 3.36.2 with pulpcore 3.120.0; the same code is on main.
Describe the bug
For a package that is not in the repository yet, the simple page links
<base>/<file>?redirect=<upstream URL> and announces its PEP 658 metadata on that
link (data-core-metadata / core-metadata). pip builds the metadata URL by
appending .metadata to the whole link, so the suffix lands in the redirect
parameter and the path still names the package:
<base>/<file>?redirect=<upstream URL>.metadata.
PythonRemote.get_remote_artifact_url() handles that form, but only on the
pull-through branch of the content handler. When the package is already in the
repository, because another client fetched it in the meantime, the handler finds it
by its path first and answers the metadata request with the package itself. pip then
fails the metadata's hash check. A client gets into this whenever it read the simple
page before the package was cached, for example two CI jobs installing the same new
package at the same time.
To Reproduce
- A distribution with a Python repository and a PyPI remote (pull-through).
- On
simple/<project>/, take the link of a wheel that is not cached yet; it carries
?redirect=and announces metadata. - GET the link: the wheel is downloaded and added to the repository.
- GET the same link with
.metadataappended: the response is the wheel (its sha256),
not the metadata.
Expected behavior
A link either announces metadata that is served at the URL pip derives from it, or
announces none.
Additional context
Fixing it on the serving side would need the query string where the package is looked
up by path, which Distribution.content_handler() does not get. Not announcing
metadata on pull-through links avoids the request altogether: installers fall back to
the metadata in the package they download, and once the package is in the repository
its local link has no query string and announces the metadata again. A pull request
doing that follows.
- 主要言語
- Python
- スター
- 49
- フォーク
- 92
- 平均マージ
- 23時間 45分
- マージ済み PR(30日)
- 38
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pulp/pulp_python のほかの issue
-
Pull-through: pip gets the wheel instead of its PEP 658 metadata (or the reverse), hash mismatch対応中かも @gerrod3 が 39 日前に担当しました。 オープンIssue
難易度 5/5 1週間以上 初心者へのやさしさ 22/100
pulp/pulp_python#1428 ·
メンテナーはふだん 2 日以内に返信
-
Issue
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
pulp/pulp_python#1219 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Feature
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
pulp/pulp_python#1005 ·
メンテナーはふだん 2 日以内に返信
-
Feature
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
pulp/pulp_python#999 ·
メンテナーはふだん 2 日以内に返信
-
Implement PEP-708 - Extend the repository API to mitigate "dependency confusion" attacks対応中かも @gerrod3 が 374 日前に担当しました。 オープンFeature
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
pulp/pulp_python#998 ·
メンテナーはふだん 2 日以内に返信
pulp/pulp_python の issue をすべて見る
似ている issue
-
Triage-Needed
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
pulp/pulp-oci-images#875 ·
-
intake mcp-intake needs-human-review priority:high type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
Ikalus1988/MisakaNet#5718 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
facebookresearch/autoform-bot#872 ·
メンテナーはふだん 1 日以内に返信
-
Dataset.to_json() writes "Value": [] for an empty sequence対応中かも @DG47 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
area: docs area: providers/oci priority: p3 size: S type: documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
finos/open-resource-broker#933 ·
メンテナーはふだん 1 日以内に返信