Skip to content

[Bug] Encrypted/password-protected files report "File contains corrupted data" instead of being detected as encrypted #150

Description

@hribcek

Summary

Opening a password-protected (encrypted) Office file fails with Error: ... File contains corrupted data. The file is not corrupted — it is a valid OOXML encryption container (CDFV2 / "Encrypted"). The message misdirects the user/agent, and there is no option to supply a password.

Environment

  • OfficeCLI v1.0.110, officecli-mac-x64
  • macOS (Intel x86_64)

Repro

# create a small xlsx, then encrypt it with a password (msoffcrypto-tool -e)
pip install msoffcrypto-tool
msoffcrypto-tool -e -p secret123 plain.xlsx encrypted.xlsx
file encrypted.xlsx          # -> "CDFV2 Encrypted"

officecli get encrypted.xlsx /
officecli validate encrypted.xlsx

Observed

Error: Cannot open encrypted.xlsx: File contains corrupted data.

(Fails gracefully and quickly — no crash/hang — but the cause is wrong.)

Expected

  • Detect the encryption container and report it clearly, e.g.
    Error: <file> is password-protected/encrypted. Supply a password with --password.
  • Ideally support a --password / OFFICECLI_PASSWORD option to open encrypted files (decrypt in-memory).

Why it matters

For AI-agent use especially, a "corrupted data" message leads the agent down the wrong path (retry/repair) instead of prompting for a password. Even without full decryption support, distinguishing encrypted from corrupted would be a meaningful UX improvement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions