Repository navigation
Conversation
Forge's zip reader accepted what .NET's ZipArchive refuses with "Split or spanned archives are not supported", so such a package was stored and listed though no NuGet client installs it: - an end record whose disk number differs from the disk where its central directory starts, or whose two entry counts differ (both checked on the 32-bit record before the ZIP64 ones are looked for, in .NET's order); - a ZIP64 end record whose total differs from its on-disk count; - a manifest whose central header names another start disk than the archive's (the ZIP64 record's when there is one), read from the header's ZIP64 field when the header marks it, as .NET reads it. Fixes #818 Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_012e6DJYq6nQn7DUc2EYRWcf
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.
Fixes #818
Problem
Forge's own zip reader (
crates/formats/nuget/src/nuspec.rs) accepted archives that .NET'sZipArchiverefuses with "Split or spanned archives are not supported". Such a package was stored and listed (hosted push, proxy download, import), though no NuGet client installs it.Change
check_eocd_candidaterefuses an end record whose disk number (offset 4) differs from the disk where its central directory starts (offset 6), then one whose two entry counts (offsets 8 and 10) differ. Both checks run on the 32-bit record before the ZIP64 records are looked for, in .NET's order (ReadEndOfCentralDirectory).check_zip64_recordrefuses a ZIP64 record whose total differs from its on-disk count.ZipArchiveEntry.IsOpenablerefuses it. The comparison follows .NET (checked against the v9.0.0 sources):0xFFFF, the one .NET reads from the header's ZIP64 field: after the values the header marks, or at its fixed place from 28 bytes on, and not at all when the field is too short (the0xFFFFthen stands). An archive that is consistently "disk 1" is still read, as .NET reads it.The refusals are
InvalidZiperrors ending in "split or spanned archives are not supported".Tests
Next to
the_end_record_is_the_one_nuget_reads, one per case:an_end_record_naming_another_disk_for_its_directory_is_refusedan_end_record_whose_entry_counts_differ_is_refuseda_zip64_record_whose_entry_counts_differ_is_refuseda_manifest_that_starts_on_another_disk_is_refusedAll four fail against the reader before this change and pass with it.
Checks run
cargo test -p forge-format-nuget: passes (63 unit tests and the crate's integration tests)cargo xtask check(cargo fmt --checkand clippy with-D warnings, workspace): passescargo xtask changelog --check: passesNot run locally: the full workspace tests and the end-to-end suites (they need Docker); CI runs them. No real
dotnet restorewas run against the crafted archives: .NET's behaviour is taken from its sources.Changelog and milestone
docs/changes/2.2.0/818.fixed.md. The issue was inBacklog; it is moved to the2.2.0milestone, since the fix ships in the next release.No admin API changes, so no web UI screen.
Generated by Claude Code