Skip to content

fix: add ZIP integrity verification for .swarm and .krillnotes files#193

Merged
careck merged 1 commit into
masterfrom
fix/180-zip-integrity
May 8, 2026
Merged

fix: add ZIP integrity verification for .swarm and .krillnotes files#193
careck merged 1 commit into
masterfrom
fix/180-zip-integrity

Conversation

@careck
Copy link
Copy Markdown
Member

@careck careck commented May 8, 2026

Summary

  • Catch CRC32 checksum mismatches and deflate stream corruption when reading ZIP entries in invite.rs (read_json_from_zip_bytes) and export.rs (read_entry)
  • Replace generic I/O errors with user-facing messages like "Archive entry 'invite.json' is corrupted (integrity check failed)"
  • Add tests for corrupted payload and truncated archive cases

Test plan

  • corrupted_zip_gives_clear_error — flips bytes in compressed payload, asserts "corrupted" in error message
  • truncated_zip_gives_clear_error — garbage ZIP bytes, asserts "Cannot read .swarm bytes" error
  • zip_round_trip_in_memory — existing test still passes (no regression)
  • Full cargo test -p krillnotes-core — 642 tests pass
  • cargo clippy and cargo fmt --check clean

Closes #180

Catch CRC32 checksum mismatches and deflate stream corruption during
ZIP entry reads in both invite (.swarm) and export (.krillnotes) paths,
replacing generic I/O errors with user-facing corruption messages.

Closes #180
@careck careck merged commit 501d0b4 into master May 8, 2026
2 checks passed
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.

Add ZIP integrity verification for .swarm files

1 participant