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 分鐘
- 30 天內合併 PR
- 38
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 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 一週以上 新手友好度 22/100
pulp/pulp_python#1428 ·
維護者通常 2 天內回覆
-
Issue
難度 3/5 1-2 天 新手友好度 58/100
pulp/pulp_python#1219 · 1 則留言 ·
維護者通常 2 天內回覆
-
Feature
難度 5/5 一週以上 新手友好度 25/100
pulp/pulp_python#1005 ·
維護者通常 2 天內回覆
-
Feature
難度 5/5 一週以上 新手友好度 25/100
pulp/pulp_python#999 ·
維護者通常 2 天內回覆
-
Implement PEP-708 - Extend the repository API to mitigate "dependency confusion" attacks可能已有人在做 @gerrod3 於 374 天前認領。 未關閉Feature
難度 5/5 一週以上 新手友好度 25/100
pulp/pulp_python#998 ·
維護者通常 2 天內回覆
相似的 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 天內回覆