Conversation
…Archive
When ZipCrypto-encrypted entries are opened via by_index(), the zip crate
returns ZipError::UnsupportedArchive("Password required to decrypt file")
before returning a ZipFile handle. This caused check_entry_encrypted() and
process_entry() to wrap the error as InvalidArchive, bypassing the
SecurityViolation branch and showing a confusing "archive may be corrupted"
hint.
Fix: detect the PASSWORD_REQUIRED error string in both call sites and
return Ok(true) / SecurityViolation respectively, matching the 7z behavior.
Add regression test using ZipCrypto-encrypted in-memory archive.
bug-ops
added a commit
that referenced
this pull request
Mar 15, 2026
The list path missed the encryption check that was added in #92 for the extract path. `list_zip` called `archive.by_index(i)` and wrapped all errors as `InvalidArchive`, so encrypted archives produced a misleading "unsupported Zip archive: Password required" message. Apply the same dual-check pattern from `zip.rs`: detect the "Password required to decrypt file" error string in `map_err` and check `entry.encrypted()` after a successful open, both returning `SecurityViolation { reason: "archive is password-protected" }`. Adds a regression test covering the encrypted ZIP list path.
bug-ops
added a commit
that referenced
this pull request
Mar 15, 2026
The list path missed the encryption check that was added in #92 for the extract path. `list_zip` called `archive.by_index(i)` and wrapped all errors as `InvalidArchive`, so encrypted archives produced a misleading "unsupported Zip archive: Password required" message. Apply the same dual-check pattern from `zip.rs`: detect the "Password required to decrypt file" error string in `map_err` and check `entry.encrypted()` after a successful open, both returning `SecurityViolation { reason: "archive is password-protected" }`. Adds a regression test covering the encrypted ZIP list path.
bug-ops
added a commit
that referenced
this pull request
Mar 15, 2026
) The list path missed the encryption check that was added in #92 for the extract path. `list_zip` called `archive.by_index(i)` and wrapped all errors as `InvalidArchive`, so encrypted archives produced a misleading "unsupported Zip archive: Password required" message. Apply the same dual-check pattern from `zip.rs`: detect the "Password required to decrypt file" error string in `map_err` and check `entry.encrypted()` after a successful open, both returning `SecurityViolation { reason: "archive is password-protected" }`. Adds a regression test covering the encrypted ZIP list path.
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.
Summary
"Password required to decrypt file"error from thezipcrate incheck_entry_encrypted()and returnOk(true)instead of wrapping it asInvalidArchiveprocess_entry()and returnSecurityViolationinstead ofInvalidArchive, matching the 7z encryption error styletest_encrypted_zip_rejected_with_security_violationthat creates a real ZipCrypto-encrypted archive in-memory and verifies the correct error variant is returnedCloses #83
Test plan
cargo nextest run -E 'test(encrypted)'— all 3 encrypted-related tests passcargo +nightly fmt --all -- --check— no formatting issuescargo clippy --all-targets --all-features --workspace -- -D warnings— no warningsRUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features --workspace— no doc warningscargo nextest run --workspace --all-features --exclude exarch-python --exclude exarch-node --lib --bins— 512 tests, all passedcargo deny check— no advisories