uv/crates/uv-metadata
Charlie Marsh 7f1eaf48c1
Harden ZIP streaming to reject repeated entries and other malformed ZIP files (#15136)
## Summary

uv will now reject ZIP files that meet any of the following conditions:

- Multiple local header entries exist for the same file with different
contents.
- A local header entry exists for a file that isn't included in the
end-of-central directory record.
- An entry exists in the end-of-central directory record that does not
have a corresponding local header.
- The ZIP file contains contents after the first end-of-central
directory record.
- The CRC32 doesn't match between the local file header and the
end-of-central directory record.
- The compressed size doesn't match between the local file header and
the end-of-central directory record.
- The uncompressed size doesn't match between the local file header and
the end-of-central directory record.
- The reported central directory offset (in the end-of-central-directory
header) does not match the actual offset.
- The reported ZIP64 end of central directory locator offset does not
match the actual offset.

We also validate the above for files with data descriptors, which we
previously ignored.

Wheels from the most recent releases of the top 15,000 packages on PyPI
have been confirmed to pass these checks, and PyPI will also reject ZIPs
under many of the same conditions (at upload time) in the future.

In rare cases, this validation can be disabled by setting
`UV_INSECURE_NO_ZIP_VALIDATION=1`. Any validations should be reported to
the uv issue tracker and to the upstream package maintainer.
2025-08-07 15:31:48 +01:00
..
src Harden ZIP streaming to reject repeated entries and other malformed ZIP files (#15136) 2025-08-07 15:31:48 +01:00
Cargo.toml Use consistent workspace inheritance (#15031) 2025-08-02 22:03:51 +02:00