Skip to content

build(deps): move zip off the yanked 2.x line to 9.0.4 - #516

Merged
AntonBabchenko merged 1 commit into
mainfrom
fix/zip-9
Oct 16, 2026
Merged

AntonBabchenko merged 1 commit into
mainfrom
fix/zip-9

Conversation

@AntonBabchenko

Copy link
Copy Markdown
Owner

Why

cargo-deny fails on main and on every PR: error[yanked]: detected yanked crate (try cargo update -p zip). On 2026-10-16 the zip maintainer yanked every release on crates.io except 9.0.3 and 9.0.4 (zip-rs/zip2#1075), over three published advisories "and other security issues that will be published later this month":

Advisory Severity Fixed in What
GHSA-vv5m-jxxh-4627 high 9.0.0 SUID/SGID bits preserved during extraction
GHSA-4v9h-p7m9-rh26 high 9.0.0 ZipArchive::extract creates symlinks whose targets are outside the destination
GHSA-4684-h2q9-2vcp high 9.0.1 ZipStreamReader::extract() / ZipArchive::extract() apply Unix permissions through symlinks

Was Lucerna exposed?

No, to the three published ones. All three live in the crate's bulk extractors. Lucerna opens untrusted archives (modpacks, mod jars, data packs, resource packs, Forge installers, world zips, natives) but never calls ZipArchive::extract or ZipStreamReader. Every site reads entries one by one and writes bytes into a regular file it names itself. No entry's Unix mode is ever applied: the only unix_mode() read rejects symlink entries, and platform::set_executable sets a fixed 0o755. No symlink is created from an entry.

The issues still to be published can't be judged today; moving off a yanked line is the reason on its own. There is no ### Security changelog bullet, since nothing a user would have hit is known.

cargo-deny justification (major bump of an existing direct dependency)

  • zip 2.4.2 → 9.0.4: every older release is yanked. MIT, MSRV 1.88 (the toolchain is stable 1.96), used only by lucerna.
  • Features ["deflate-flate2", "deflate-zopfli"], not 9.x's deflate. That one adds the zlib-rs backend; these two keep the miniz_oxide backend Lucerna's own flate2 = { features = ["rust_backend"] } already brings, as 2.x's deflate did. Default features stay off.
  • Lock: typed-path 0.12.3 added (MIT OR Apache-2.0, a 9.x dependency); arbitrary and derive_arbitrary removed. Nothing else moves. cargo tree -i zlib-rs finds nothing.

Migration: behaviour kept, where 9.x moved semantics

  • ZipFile::name() / file_names() return ZipResult<Cow<str>>. Its only error is CP437 decoding failing on all-ASCII bytes that are not UTF-8, which cannot happen. A new crate::zip_entry reads every name one way; its fallbacks never run (lossy UTF-8, as 2.x gave a mis-flagged name; a logged skip in a listing). All call sites ported with no change in control flow.
  • by_name matches raw bytes, not the decoded name. A listed entry looked up again by name would miss a non-UTF-8 (CP437) entry. The legacy @Mod class scan and the nested-jar reader now read by index. New test a_class_named_in_cp437_is_read: red on the naive port, green here.
  • enclosed_name() makes a rooted name relative (/abs.dll → abs.dll) where 2.x refused it. Natives extraction skips rooted entries itself, as before. The existing zip-slip test now asserts it: red on the naive port.
  • Checked unchanged:
    • is_dir;
    • unix_mode (it now clears SUID/SGID/sticky; the file type the symlink check reads is kept);
    • the default write time (1980; the time feature stays off, and the l10n byte-stability test pins it);
    • Deflated at the default level still uses flate2 (zopfli only above level 9; Lucerna sets no level).
  • Name decoding now tries UTF-8 before CP437 (2.x went by the UTF-8 flag). This only differs for an unflagged non-ASCII name, which now reads correctly instead of as mojibake.

Test plan

  • cargo check --all-targets
  • the full structural guard set (23 guards, including the store / datapacks / import chokepoints)
  • the zip-heavy unit tests locally (datapacks, forge, l10n, modpacks, local mods, servers import, worlds, natives: 1563 passed)
  • the two new pins seen red on a naive port first
  • CI green, including cargo-deny

🤖 Generated with Claude Code

The zip maintainer yanked every release but 9.0.3/9.0.4 on 2026-10-16
(zip-rs/zip2#1075) over three published advisories in the crate's bulk
extractors and issues still to be published. cargo-deny fails on the
locked 2.4.2. Lucerna never calls those extractors.

- deflate-flate2 + deflate-zopfli instead of 9.x's deflate, which adds the
  zlib-rs backend: flate2 stays on rust_backend (miniz_oxide), as before.
- name() is a Result in 9.x; crate::zip_entry reads every entry name one
  way (its error is unreachable: CP437 never fails on non-ASCII bytes).
- by_name now matches raw bytes: the @mod class scan and the nested-jar
  reader read a listed entry back by index (test: a CP437 class name).
- enclosed_name now makes a rooted name relative; natives extraction keeps
  skipping rooted entries (the existing test asserts it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AntonBabchenko
AntonBabchenko merged commit 1064eeb into main Oct 16, 2026
12 checks passed
@AntonBabchenko
AntonBabchenko deleted the fix/zip-9 branch October 16, 2026 10:36
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