Repository navigation
Upgrade zip4j to 2.11.6 and report archive write failures - #580
Open
tonygermano wants to merge 1 commit into
Open
tonygermano wants to merge 1 commit into
tonygermano wants to merge 1 commit into
Conversation
Replace the vendored zip4j 1.3.3 jars in server/lib and client/lib with the net.lingala.zip4j:zip4j:2.11.6 Maven Central artifact, which has no dependencies of its own. It still stages into server-lib and client-lib, now as zip4j-2.11.6.jar. Zip4j is only used to write password-protected ZIP archives, which the JRE and commons-compress cannot do. Port ArchiveUtils to the 2.x API; the password is now given to the ZipOutputStream. EncryptionType no longer exposes zip4j 1.x integer constants and returns an AesKeyStrength instead. Entry names are written with forward slashes, as zip requires, whatever the platform. Delete our modified copies of Unzip and UnzipEngine, which carried a Zip Slip fix for zip4j 1.x extraction. Nothing in the engine extracts with zip4j (the extension installer uses java.util.zip and has its own check), and the copies are built against 1.x internals that no longer exist. Remove them from the client-core jar, drop their tests, the THIRD-PARTY-README note and the ZipTestUtils method only they used. Make failures writing an archive visible and leave nothing behind: - ArchiveUtils now closes the archive explicitly, for every format, so a failure writing its end (the zip central directory, the tar end-of-archive records, a compressor's footer) is reported. It used to be swallowed by closeQuietly for tar and for ZIP with a compressor, so a full disk gave a truncated archive that was moved into place and the source folder deleted. - Zip4j 2.x does not close the underlying stream when finishing the archive fails, as 1.x did, so ArchiveUtils keeps the FileOutputStream and closes it itself. Entries are closed only after a successful copy: closing them in a finally block replaced the original failure, for example a full disk, with a NullPointerException from closing an entry that was never opened. - MessageWriterArchive deletes the file the archive was being built in when archiving fails. If only moving the finished archive into place fails, it keeps that file. Only plain ZIP archives can be password protected. Previously a password combined with another archiver or with a compressor was silently ignored and an unprotected archive was written. MessageWriterFactory now rejects that combination when the writer is created, before any message is written, and ArchiveUtils.createArchive refuses it as well. A data pruner configured this way, which the administrator cannot produce but the API or a hand-edited configuration can, now fails on each run instead of archiving unprotected, so its channel is not pruned until the configuration is corrected. Correct the stale comment about commons-compress while there. Tests: encrypted ZIP output for each encryption type (method, key strength, extraction with the password, rejection of a wrong one, and the JDK refusing the archive); tar, tar.gz, zip.gz and empty-folder output; writes to /dev/full for each format, which are skipped where that is unavailable; the password rules, including that a password is ignored when not enabled; and MessageWriterArchive end to end, including keeping a finished archive that could not be moved into place. The smoke test also checks that a password for a TAR is refused. Only the zip4j checksums are added to the verification metadata; unrelated missing entries are left for a separate cleanup. Issue: #337 Issue: #472 Assisted-by: Claude:claude-sonnet-5-5 Signed-off-by: Tony Germano <tony@germano.name>
tonygermano
requested review from
gibson9583 and
kayyagari
and removed request for
a team
November 16, 2026 16:59
Test Results 143 files ± 0 143 suites ±0 4m 25s ⏱️ +16s Results for commit f337c56. ± Comparison against base commit 7cc7cd5. This pull request removes 13 and adds 24 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
NicoPiel
approved these changes
Nov 16, 2026
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.
Upgrades zip4j from the vendored 1.3.3 jar to
net.lingala.zip4j:zip4j:2.11.6from Maven Central, and makes archive failures visible.ArchiveUtilsis ported to the 2.x API, andEncryptionType.getKeyStrength()now returns anAesKeyStrength.UnzipandUnzipEngineand their tests. Nothing in the engine extracts with zip4j, and they depend on 1.x internals.Behavior change: a data pruner configured with a password plus TAR or a compressor, which the administrator UI can't produce but the API or a hand-edited configuration can, now fails on each run instead of archiving unprotected. Its channel isn't pruned until the configuration is fixed.
Relates to #337 and #472, without resolving either.
Claude checked:
./gradlew clean build distpasses on this branch./dev/fullfor each format, and the password rules.Reviewer notes
MessageServlet,getMessageWriterOptions) never setspasswordEnabled, so a password sent that way is dropped and an unprotected ZIP is written.Release notes
🤖 Drafted with Claude Code