Skip to content

fix: reject invalid attachment salt hex instead of silent fallback#187

Open
careck wants to merge 1 commit intomasterfrom
fix/176-remove-salt-fallback
Open

fix: reject invalid attachment salt hex instead of silent fallback#187
careck wants to merge 1 commit intomasterfrom
fix/176-remove-salt-fallback

Conversation

@careck
Copy link
Copy Markdown
Member

@careck careck commented May 5, 2026

Summary

  • Removed unwrap_or_else fallback on hex::decode of attachment salt in restore_attachment() and SubtreeRestore undo path — malformed hex now returns an explicit AttachmentEncryption error instead of silently using wrong key material
  • Added test that verifies restore_attachment with an invalid salt hex string returns AttachmentEncryption

Test plan

  • cargo test -p krillnotes-core — 629 tests pass (1 new)
  • New test test_restore_attachment_rejects_invalid_salt_hex would have failed before the fix (fallback swallowed the bad salt)

Closes #176

Replace unwrap_or_else fallback with explicit AttachmentEncryption error
at both salt decode sites (restore_attachment and SubtreeRestore undo).

Closes #176
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.

Remove attachment salt hex decode fallback

1 participant