Repository navigation
Conversation
zip.Writer.CreateHeader encodes the MS-DOS date and time fields in the location of Modified without converting to UTC. time.UnixMilli(0) is in the host's local zone, so the stabilized bytes of every wheel, egg and jar depended on TZ and attested stabilized digests only reproduced on a UTC host. Output on a UTC host is unchanged.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
StableZipModifiedTimesetModifiedtotime.UnixMilli(0), which is in the host's local zone.zip.Writer.CreateHeaderencodes the MS-DOS date and time in the location ofModifiedwithout converting to UTC. As a result the stabilized bytes of every wheel, egg and jar depended onTZ. An attestedstabilized/<artifact>digest could only be reproduced withcmd/stabilizeon a UTC host.This change pins the value to UTC. Output on a UTC host is byte-identical to before, so digests already recorded in attestations stay the same. For example, with the one-line change applied at the attested
serviceSourcerefs, the published stabilized digests for six 1.17.0 (b06155c5...) and absl-py 2.0.0 (21a8a58d...) reproduce underTZset to UTC, Europe/Berlin, America/New_York and Asia/Kolkata. Before the change they only reproduce under UTC.Tar and gzip stabilizers are not affected since those formats store Unix seconds.
Testing:
TestStabilizeZipLocalTimeZonestabilizes the same zip withtime.Localset to UTC, UTC+9 and UTC-5 and compares the bytes withcmp.Diff. It fails on main for the two non-UTC cases and passes with the fix.go test ./pkg/... ./internal/...andgo run ./ci checkpass.StabilizeZipwith all zip stabilizers on the absl-py 2.0.0 wheel (200 iterations per run, 15 runs each, main and this change alternating): median 3070.4 µs on main and 3103.8 µs with this change.This change was drafted with Claude Code (claude-opus-5-5); the test results above are from the runs described.