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
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 50/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
[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
- Langage dominant
- Rust
- Étoiles
- 9
- Forks
- 2
- Merge moyen
- 1 j 8 h
- PR mergées (30 j)
- 313
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de SocketDev/socket-patch
-
agent:triaged arch-audit bug priority:p2
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
SocketDev/socket-patch#2306 ·
Les mainteneurs répondent en général sous 1 jour
-
agent:triaged arch-audit bug priority:p3
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
SocketDev/socket-patch#2296 ·
Les mainteneurs répondent en général sous 1 jour
-
agent:needs-human agent:triaged ci-janitor priority:p1
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
SocketDev/socket-patch#2270 · 3 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
agent:triaged arch-audit bug priority:p1
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
SocketDev/socket-patch#2259 ·
Les mainteneurs répondent en général sous 1 jour
-
agent:triaged arch-audit priority:p3 refactor
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
SocketDev/socket-patch#1860 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de SocketDev/socket-patch
Issues similaires
-
Find/Replace panel: "Previous/Next occurrence" labels overlap and overflow their buttons (French)Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 63/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
obi1kenobi/cargo-semver-checks#1839 · 3 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Bash init calls `cygpath` unconditionally on Windows, which breaks non-Cygwin shells like `brush`Peut-être pris @iliqiliev l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
ajeetdsouza/zoxide#1381 ·
Les mainteneurs répondent en général sous 5 jours
-
triage
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
kornia/kornia-rs#1416 · 1 commentaire ·
Les mainteneurs répondent en général sous 2 jours