Skip to content

Check mirrored files against their own SHA-256 - #592

Merged
andrew merged 1 commit into
git-pkgs:mainfrom
simonchrz:fix/mirror-file-digest
Oct 25, 2026
Merged

andrew merged 1 commit into
git-pkgs:mainfrom
simonchrz:fix/mirror-file-digest

Conversation

@simonchrz

Copy link
Copy Markdown
Contributor

Fixes a bug from #591, which isn't in a release yet.

The PyPI mirror passed each file's sha256 as the integrity that GetOrFetchArtifactFromURLWithIntegrity records with the version. All wheels of a version are cached under the same name and version, so the last file's checksum replaced the others'. Serving the other wheels from the cache then failed the integrity check: the proxy aborted the response.

The mirror now passes the sha256 as a digest (GetOrFetchArtifactFromURLWithDigest), which is checked against that file's content hash alone.

TestMirrorPyPIFetchesEveryFile now has two wheels of one version; it fails without the change.

Mirroring a PyPI version passed each file's sha256 as the integrity
GetOrFetchArtifactFromURLWithIntegrity records with the version. Wheels of
one version share the name and version they are cached under, so the last
file's checksum replaced the others', and serving the other wheels from
the cache failed the integrity check.

The mirror now passes the sha256 as a digest, which is checked against
that file's content hash alone.
This was referenced Oct 25, 2026
@andrew
andrew merged commit 6cdd926 into git-pkgs:main Oct 25, 2026
7 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.

2 participants