Skip to content

test: validate RAR5 and 7z archives with encrypted headers - #196

Merged
nextestudios merged 1 commit into
mainfrom
feature/70-encrypted-headers
Sep 27, 2026
Merged

nextestudios merged 1 commit into
mainfrom
feature/70-encrypted-headers

Conversation

@nextestudios

Copy link
Copy Markdown
Owner

Summary

  • Adds header-encrypted fixtures: rar/Rar5.encrypted_filesAndHeader.rar (copied unchanged from SharpCompress, MIT, same commit as the other fixtures) and 7z/cabecalho-protegido.7z (286 bytes, generated with 7-Zip 25.01 -mhe=on; provenance in tests/Fixtures/README.md).
  • Bug fixed: 7z has no password check value, so a wrong password on an encrypted file list failed as a corrupt header and the browser showed an error instead of asking again. SharpCompressEngine now reports WrongPassword when a decoding failure happens with a password and the header can only be read with one.
  • CanReadEncryptedHeaders is now true for 7z and RAR; docs/archive-support.md updated with observed results (RAR4 header encryption still has no fixture and stays unvalidated).

Tests (CI)

  • FormatTests.Header_encrypted_archive_lists_and_extracts_only_with_the_right_password (RAR5 + 7z): missing → PasswordRequired, wrong → WrongPassword (inspect and extract), right → every file is encrypted, lists and extracts with known SHA-256.
  • ArchiveBrowserJourneyTests: opening the header-encrypted 7z asks for the password before listing, a wrong one re-asks with "Senha incorreta. Tente novamente.", the right one lists the entries.

No UI change; no manual checks needed.

Closes #70

🤖 Generated with Claude Code

Add a RAR5 fixture from SharpCompress and a generated 7z (-mhe=on) whose
file lists are encrypted. Listing without the password asks for it, a
wrong one is refused and the right one lists and extracts.

7z has no password check value, so a wrong password surfaced as a
corrupt header and the browser showed an error instead of asking again.
When the header can only be read with a password, a decoding failure with
a password is now reported as a wrong password.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@nextestudios
nextestudios force-pushed the feature/70-encrypted-headers branch from 96423cc to f3f35dd Compare September 27, 2026 22:12
@nextestudios
nextestudios merged commit 68798f7 into main Sep 27, 2026
1 check passed
@nextestudios
nextestudios deleted the feature/70-encrypted-headers branch September 27, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: validate RAR and 7z archives with encrypted headers

1 participant