fix: list command returns SecurityViolation for encrypted ZIP (#96)#98
Merged
fix: list command returns SecurityViolation for encrypted ZIP (#96)#98
Conversation
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.
acba386 to
93ee4a8
Compare
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
list_zipwas callingarchive.by_index(i)and mapping all errors asInvalidArchive, causing encrypted ZIP archives to produce a misleading "unsupported Zip archive: Password required" message instead of a security violationzip.rs): detect "Password required to decrypt file" inmap_errand checkentry.encrypted()after a successful openlistpath with an encrypted ZIPFixes #96.
Test plan
cargo nextest run --workspace --all-features --exclude exarch-python --exclude exarch-node --lib --bins— all 519 tests passinspection::list::tests::test_list_zip_encrypted_returns_security_violationpassescargo +nightly fmt --all -- --check— cleancargo clippy --all-targets --all-features --workspace -- -D warnings— clean