Skip to content

0.3.3: treat the package index as untrusted in mpat diff - #12

Merged
yudelevi merged 1 commit into
mainfrom
harden-upstream-fetch
Oct 8, 2026
Merged

yudelevi merged 1 commit into
mainfrom
harden-upstream-fetch

Conversation

@yudelevi

@yudelevi yudelevi commented Oct 8, 2026

Copy link
Copy Markdown
Owner

The index page controls the archive filename (a cache path) and the download URL. packaging accepts sdist names like ../../x-1.0.tar.gz and urllib opens file://, so a hostile or tampered index could write outside MPAT_CACHE_DIR or read a local file. Only archives named for the locked project and only http(s) links are used now, and error messages drop query strings and userinfo so signed download URLs stay out of CI logs.

Found by a background security review of 0.3.2. Exposure needs a malicious or MITM'd index and an opt-in --diff/mpat diff run. 382 tests pass on 3.11-3.14.

The index page decides both the archive filename, which becomes a path in
the cache, and the download URL. packaging accepts an sdist name like
../../x-1.0.tar.gz, and urllib happily opens file:// URLs, so a hostile or
tampered index could write outside MPAT_CACHE_DIR or read local files.
Only archives named for the locked project and only http(s) links are
used now. Error messages also drop query strings and userinfo, since
signed object-storage URLs carry their token in the query and these
messages land in CI logs.
@yudelevi
yudelevi merged commit 5264daf into main Oct 8, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant