vex writes no document for a hosted PyPI patch under a rules_python hub when a virtualenv still holds the unpatched release, and the docs promise one
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 50/100
Hướng nghiên cứu
Start with docs/ecosystems.md and the hosted-patch VEX verification that emits the stale_install and not_applied warnings; the issue does not name the implementation files. Compare that check with the agent-patch affected path and the pypi::hosted_pip_parse coverage in e2e_bazel_build/pypi.rs. Done when the behavior and documentation agree for a Bazel hub using the pinned lock while a virtualenv has an unpatched copy, with a regression test covering the reported commands.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
[agent] Found by the scheduled Bazel bug-hunt routine (ledger #2262).
Summary
In a Bazel workspace whose rules_python pip.parse hub reads the project's requirements.txt, a hosted PyPI patch gets no VEX statement when a virtualenv in the project still holds the unpatched release. scan --mode hosted --yes --vex <file> pins the patch in requirements.txt and then exits 1 with "VEX generation failed"; a later socket-patch vex exits 1 as well (not_applied) and writes no document. The hub builds from requirements.txt, which now names the patched wheel, and never from the virtualenv, so the document is missing for a build that is the patched one.
docs/ecosystems.md documents exactly this for NuGet (the table cell "Supported; for a hosted patch, with no restored copy on the machine", and the known problem "vex for a hosted NuGet patch"). The PyPI cell says "Supported" with no condition, and the known problems name no PyPI case. So this is a docs promise that is wider than the behaviour, or a vex that should not let a virtualenv decide about a package the hub builds: either way the two don't agree.
Impact
A developer machine often has a .venv beside the Bazel workspace (for the editor, or for scripts outside Bazel). There the one command of hosted mode with --vex exits 1 after it wrote the pin, and vex produces nothing until that virtualenv is reinstalled, which has no bearing on what Bazel builds. Nothing is harmed and nothing false is attested: this is a missing document and a failing exit code, not a wrong statement. Vendored mode as a download cache is not affected: with the same virtualenv it attests the package from the committed wheel, with a warning.
Repro
No real bazel build ran for this report (the sandbox of the routine cannot reach the Bazel registry). The files are the checkout of tests/fixtures/bazel/rules_python/bzlmod as e2e_bazel_build/pypi.rs sets it up without a Bazel, against a loopback stand-in for the Socket API, the patch host and the index (--api-url, SOCKET_PATCH_SERVER_URL, SOCKET_PYPI_JSON_API), as that test file does. That the hub builds the patched wheel from the hosted pin is what pypi::hosted_pip_parse holds on the nightly legs (Bazel 9.3.2, 8.8.2, 7.7.2), which are green.
- A checkout with the fixture's
MODULE.bazel(pip.parse(requirements_lock = "//:requirements.txt")),.bazelrc,BUILD.bazel, and a hashedrequirements.txtthat pinsspvictim==1.0.0andspdep==2.0.0. - A virtualenv in the project that holds the upstream wheel:
.venv/pyvenv.cfg, and the unpackedspvictim-1.0.0wheel under.venv/lib/python3.11/site-packages/. socket-patch scan --mode hosted --yes --vex out.vex.json --vex-product pkg:generic/xsocket-patch vex --product pkg:generic/x
Step 3 (the pin is written to requirements.txt, no out.vex.json):
Warning: omitting pkg:pypi/[email protected] from VEX: the installed copy is not patched (stale_install)
Warning: pkg:pypi/[email protected] was switched to a hosted patch, but installed files in ./.venv/lib/python3.11/site-packages still differ from the patched hashes. Reinstall from the rewritten lock in this interpreter and verify with `socket-patch vex`. [...]
Error: VEX generation failed: No applied patches with vulnerability metadata to attest.
exit 1
Step 4:
Warning: omitting pkg:pypi/[email protected] from VEX: the patched files still hold the original content (not_applied)
Error: No applied patches with vulnerability metadata to attest.
The patched packages are not installed yet: the installed copies still hold their original files. Reinstall from the lockfile (hosted or vendored patches) or run `socket-patch apply` (agent-mode patches), then run `socket-patch vex` again.
exit 1
Without step 2, the same two commands exit 0 and write one not_affected statement ("Patched via Socket patch ... (redirected)"). vex --no-verify writes that statement with the virtualenv present too.
Expected
docs/ecosystems.md, "Bazel workspaces: what is supported": the PyPI row says VEX is "Supported", which the section defines as "socket-patch vex and --vex say not_affected of a package the Bazel build takes patched". "Bazel workspaces: VEX" says a hub builds a package "never from node_modules, a virtualenv, a gem home, a cargo home or NuGet's packages folder".
Either the document is written for a package the hub builds from the pinned lock, whatever a virtualenv holds, or the PyPI cell and the known problems carry the condition the NuGet ones carry ("with no unpatched installed copy on the machine"), and the message says that the virtualenv, not the Bazel build, is what stands in the way.
Actual
No document, exit 1, and advice to reinstall a virtualenv that the Bazel build does not use. The run with --vex reports failure although its pin was written.
Versions
| Result | |
|---|---|
main cfc870f, Linux x86_64, files of the rules_python 2.5.0-rc4 fixture, virtualenv with the upstream release |
reproduces (twice: scan --vex, and scan then vex) |
| the same without the virtualenv | does not reproduce: one not_affected statement |
the same with the virtualenv, scan --mode vendored (download cache) |
does not reproduce: one not_affected statement, with a warning that the installed tree differs |
| v5.1.0 | not applicable: no Bazel support, and no promise about a Bazel build |
Not tried: other ecosystems. The same may hold for an npm, RubyGems or Cargo hosted patch beside an installed copy that is not the patched one; only NuGet is documented.
Suspect location
The hosted-patch verification that vex runs against the installed copy (the stale_install / not_applied omission) does not ask whether a hub call of the workspace builds the package from the lock, while the affected path for agent patches does. Docs: docs/ecosystems.md, the PyPI row of the table under "Bazel workspaces: what is supported" and the known-problems list beside "vex for a hosted NuGet patch".
Generated by Claude Code
- Ngôn ngữ chính
- Rust
- Star
- 9
- Fork
- 2
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 313
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SocketDev/socket-patch
-
agent:triaged arch-audit bug priority:p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
SocketDev/socket-patch#2306 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged arch-audit bug priority:p3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
SocketDev/socket-patch#2296 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:needs-human agent:triaged ci-janitor priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SocketDev/socket-patch#2270 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged arch-audit bug priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
SocketDev/socket-patch#2259 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged arch-audit priority:p3 refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
SocketDev/socket-patch#1860 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SocketDev/socket-patch
Issue tương tự
-
Bash init calls `cygpath` unconditionally on Windows, which breaks non-Cygwin shells like `brush`Có thể đã có người làm @iliqiliev đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ajeetdsouza/zoxide#1381 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
triage
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
kornia/kornia-rs#1416 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
paritytech/revive#749 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
swc-project/swc-next-issues#1043 ·