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 antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 50/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
[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
- Vorherrschende Sprache
- Rust
- Sterne
- 9
- Forks
- 2
- Ø Merge
- 1 T. 8 Std.
- Gemergte PRs (30 T.)
- 313
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus SocketDev/socket-patch
-
agent:triaged arch-audit bug priority:p2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
SocketDev/socket-patch#2306 ·
Maintainer antworten meist innerhalb von 1 Tag
-
agent:triaged arch-audit bug priority:p3
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
SocketDev/socket-patch#2296 ·
Maintainer antworten meist innerhalb von 1 Tag
-
agent:needs-human agent:triaged ci-janitor priority:p1
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
SocketDev/socket-patch#2270 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
agent:triaged arch-audit bug priority:p1
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
SocketDev/socket-patch#2259 ·
Maintainer antworten meist innerhalb von 1 Tag
-
agent:triaged arch-audit priority:p3 refactor
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
SocketDev/socket-patch#1860 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in SocketDev/socket-patch
Ähnliche Issues
-
Find/Replace panel: "Previous/Next occurrence" labels overlap and overflow their buttons (French)Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 63/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
obi1kenobi/cargo-semver-checks#1839 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Bash init calls `cygpath` unconditionally on Windows, which breaks non-Cygwin shells like `brush`Evtl. vergeben @iliqiliev hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
ajeetdsouza/zoxide#1381 ·
Maintainer antworten meist innerhalb von 5 Tagen
-
triage
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
kornia/kornia-rs#1416 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen