Skip to content

Verify encrypted backup contents before reporting success - #667

Open
Jacksper13 wants to merge 2 commits into
fix/backup-verification-errorsfrom
fix/backup-content-verification
Open

Verify encrypted backup contents before reporting success#667
Jacksper13 wants to merge 2 commits into
fix/backup-verification-errorsfrom
fix/backup-content-verification

Conversation

@Jacksper13

@Jacksper13 Jacksper13 commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • require the Backup Code before verifying an encrypted backup
  • share Restore's read-only decrypt and plaintext-CRC validation path with Verify
  • decrypt into a single mutable plaintext buffer, clear it on failures, and explicitly zero it before Verify returns
  • preserve distinct card, file I/O, malformed-header, decrypt/integrity, and out-of-memory failures
  • ensure every verification and restoration error leaves the spinner flow through a terminal path
  • correct archive magic validation and truncated-header error handling
  • document the user-visible verification change in the changelog

The existing backup format remains unchanged. This verifies decryption and the format's plaintext CRC; it does not add cryptographic authentication.

Testing

  • python -m pytest modules/tests/test_backup_reader.py modules/tests/test_verify_backup_task.py modules/tests/test_verify_backup_flow.py -q (22 passed)
  • python -m pycodestyle on all changed Passport Python files
  • color MicroPython simulator build
  • direct MicroPython archive test covering valid decrypt, wrong code, encrypted-body corruption, malformed headers and metadata, truncation, and size limits

Dependency

This PR is stacked on #657 so the smaller callback/error-handling fix can remain independently reviewable.

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.

1 participant