Skip to content

bug: list command shows misleading "invalid archive" error for encrypted ZIP (fix #83 incomplete) #96

@bug-ops

Description

@bug-ops

PR #92 fixed encrypted ZIP detection in the extract path (ZipArchive::newis_password_protected), but the list command goes through inspection/list.rs:list_zip which calls archive.by_index(i) without any encryption check.

Reproduction

# Create encrypted ZIP (any tool, e.g. zip -e or Python)
cargo run --package exarch-cli -- list encrypted.zip

Output:

Error: failed to list archive: encrypted.zip

Caused by:
    invalid archive: failed to read ZIP entry: unsupported Zip archive: Password required to decrypt file

Expected output:

Error: security violation: archive is password-protected.

Root cause

inspection/list.rs line 252: archive.by_index(i).map_err(|e| ExtractionError::InvalidArchive(...)) — does not check e.to_string().contains("Password required to decrypt file").

Fix

Apply the same pattern as zip.rs:check_entry_encrypted — either:

  1. Call is_password_protected at the top of list_zip before iterating entries, or
  2. In the map_err closure at line 252, check for the password error string and return SecurityViolation.

Option 1 is cleaner (fail fast before iterating).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions