tafia / calamine

A pure Rust Excel/OpenDocument SpreadSheets file reader: rust on metal sheets
MIT License
1.6k stars 155 forks source link

Detect password protected xls files #386

Closed saks closed 6 months ago

saks commented 6 months ago

This PR fixes #385. It looks like Protect record that is currently used for password protected files detection may not be the best option. There are two reasons:

  1. It is easy to find/create a file that triggers unrelated error.
  2. Spec suggests that:

    A property that is applied manually to a file or a portion of a file, with or without a password, and that helps prevent users from accidentally or deliberately changing, moving, or deleting data.

this property may signify another kind of protection but not necessarily the password one. I've noticed that some libraries are trying to detect "FilePass" instead and it works better for problematic files that we have.

I was not able to determine if it is necessary to keep logic related to "Protect" record in place (my changes do not break any tests), please suggest if we need to keep it.

tafia commented 6 months ago

Thanks!