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
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 50/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
[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
- Lenguaje dominante
- Rust
- Estrellas
- 9
- Forks
- 2
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 313
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de SocketDev/socket-patch
-
agent:triaged arch-audit bug priority:p2
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
SocketDev/socket-patch#2306 ·
Los mantenedores suelen responder en 1 día
-
agent:triaged arch-audit bug priority:p3
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
SocketDev/socket-patch#2296 ·
Los mantenedores suelen responder en 1 día
-
agent:needs-human agent:triaged ci-janitor priority:p1
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
SocketDev/socket-patch#2270 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
agent:triaged arch-audit bug priority:p1
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
SocketDev/socket-patch#2259 ·
Los mantenedores suelen responder en 1 día
-
agent:triaged arch-audit priority:p3 refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
SocketDev/socket-patch#1860 ·
Los mantenedores suelen responder en 1 día
Todos los issues de SocketDev/socket-patch
Issues similares
-
Bash init calls `cygpath` unconditionally on Windows, which breaks non-Cygwin shells like `brush`Posiblemente ocupada @iliqiliev la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ajeetdsouza/zoxide#1381 ·
Los mantenedores suelen responder en 5 días
-
triage
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
kornia/kornia-rs#1416 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
paritytech/revive#749 ·
Los mantenedores suelen responder en 3 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
swc-project/swc-next-issues#1043 ·