Repository navigation
fix(check): check PyPI packages when requirements use PyTorch --extra-index-url - #233
Conversation
|
Thanks, @dev-burnern! An allowlist that names who runs each host, plus hostnames only (never URLs) in the output, is the right shape for this, and the credential and The review found a few inputs where the new option reader sees a line differently from pip and wheelgap 0.13.0, and where it does, private names would be sent to pypi.org. Because this changes what the checker keeps private, Patrick will take this one himself:
A likely direction is to reuse wheelgap's own (Review assisted by Claude.) |
…osed _public_extra_indexes() matched exact flag names, so lines pip and wheelgap 0.13.0 read as another index (-ihttps://corp, -f./wheels, --index URL, --extra URL, --no-i), includes it didn't follow (-rcorp.txt, --requirem corp.txt) and a first-line option behind a byte-order mark left the file public, and its names went to pypi.org. It now takes the lines sources._read_requirements() collects as index options (the file and its includes, utf-8-sig, pip's line joining and abbreviations) and accepts only a whole '--extra-index-url URL' line on a listed https host with a plain path; anything else, or any error, keeps the file private. Checked against pip 25.3's own requirements parser on the same files. The browser never fetches a uv.toml, pyproject.toml or pdm.toml beside the file, so plan() now lists them and the worker passes the list: one in the file's folder or above, or no list, keeps it private too. A row's reason is now its Fix text and is named in the alert, and the 'uvx wheelgap FILE checks PyPI's files' advice is kept to requirements files and pyproject.toml (the CLI skips a Pipfile.lock's or pixi.lock's pinned index too). Co-Authored-By: Claude Opus 5.5 <[email protected]>
When GitHub truncates the tree, plan()'s configs can miss a root uv.toml or pyproject.toml, so an --extra-index-url file could be taken as public. The worker now passes null then, which the driver treats as uncertain and keeps the file private. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolved with wheelgap#235 as its reviewer set out. Main's CONFIG_NAMES, plan() configs (any case), configs_for, configsJson, fetchConfigs, dropOtherProjects(py, repo, keep) and the truncated-tree null replace wheelgap#233's own; worker.mjs is now main's. check() uses main's _reads_offline. _public_extra_hosts() now starts with _unread_configs(), since _private() returns before it reads source.pypi_only for a file taken as public and would otherwise skip wheelgap#235's fail-closed check; it still refuses any settings file listed beside or above the file, read or not; its docstring no longer says the browser doesn't fetch them. The reader-based advice moved into privateText()'s names-an-index branch, so unread or unknown settings keep their own text; renderTable's Fix text shows an unknown row's reason. Tests: main's harnesses taken, wheelgap#233's tests kept with the renderVerdict harness given privateText, privatePyprojectReason and cliCommand, plus driver tests that an extra-index file is never looked up when a nearby settings file couldn't be fetched, the list is unknown or a read one sits beside it, and privateText's reader cases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a plain uvx wheelgap for withheld names
pip shlex-splits an option line and expands ${VAR} in it, but wheelgap 0.13.0's collector splits on whitespace. So -'i' URL, --"index-url" URL, --ext\\ra-index-url URL, --no-ind''ex and -${OPT} URL are index options to pip (checked with pip 25.3's own parser), but the collector misses them, and the PyTorch line beside one made the file public. Now any option line in the file or its includes with a quote, a backslash or a $ keeps it private. The 'uvx wheelgap FILE in a checkout checks them on PyPI's files' advice is gone too: wheelgap's CLI looks a requirements file's packages up on PyPI unless --index-url names another index, so following it would send the withheld names there. The names-an-index branch is main's --index-url sentence again, and the unread and unknown branches (wheelgap#235) now say to pass --index-url with the project's index, and why.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merged, thanks @dev-burnern! This one needed the most care, since a mistake here would send private package names to pypi.org. Before merging, we made the page refuse any option line it can't read exactly as pip does (quotes, backslashes, (Posted with help from Claude.) |
Closes #219
What this changes
site/check/driver.py:PUBLIC_EXTRA_INDEXESallowlist starting withdownload.pytorch.org(PyTorch Foundation), mapping to{"torch", "torchvision", "torchaudio"}._public_extra_indexes(root, path)to inspect option lines in a requirements file and its fetched-r/-cincludes: allows PyPI lookups only when every index option is a credential-free--extra-index-urlon an allowlisted host and no siblingpyproject.toml/uv.tomlconfigures an index. Any--index-url,--find-links,--no-index, unlisted host, URL with credentials, or unreadable line keeps the entire file private.torch,torchvision,torchaudio) asunknownwith"reason": "may be installed from download.pytorch.org, which this page doesn't read"instead of querying PyPI, while checking all other packages on PyPI."extra_indexes"(allowlisted hostnames only, never full URLs) incheck()'s JSON output.site/check/check.mjs:r.extra_indexes:<lockfile> also installs from <host> (--extra-index-url). This page checked PyPI only.uvx wheelgap <lockfile>in a checkout (checking PyPI's files) rather than misleadingly suggestinguvx wheelgap --index-url.tests/test_check_driver.py&tests/site/check-page.test.mjs:--extra-index-url(PyPI lookup +torch/torchvisionunknown with reason), mixed--index-url(private), credentialed URL on listed host (private, URL never leaked in output),--extra-index-urlin an included file,test_a_private_index_package_is_never_looked_up_on_pypiunchanged, and the new alert wording inrenderVerdict().AI tools used (if any): Antigravity (Gemini)
Checklist
pytest tests/test_check_driver.py -k "private or pytorch"passesnode --check site/check/check.mjsandnode --test tests/site/check-page.test.mjspass (13/13)