Skip to content

fix: audit fixes — silent send failures, caching, safety, cleanup#16

Merged
radiosilence merged 5 commits intomainfrom
polecat/obsidian/fc-xym@mn7o6rrl
Mar 26, 2026
Merged

fix: audit fixes — silent send failures, caching, safety, cleanup#16
radiosilence merged 5 commits intomainfrom
polecat/obsidian/fc-xym@mn7o6rrl

Conversation

@radiosilence
Copy link
Copy Markdown
Owner

Summary

Critical and major fixes from code audit (fc-xym):

Batch 1 (done)

  • Fix silent send failures: Check EmailSubmission/set response — previously email could be created but submission silently fail
  • Fix forward body HashMap ordering: Used bv.values().next() on HashMap (non-deterministic); now uses text_content() to get correct body part
  • Fix Output::print panic: Replace .unwrap() with graceful error handling
  • Remove unsafe env var tests: Eliminated unsafe { std::env::set_var/remove_var } blocks
  • Commit Cargo.lock: Binary crate should have reproducible builds
  • Cache mailbox list: Avoid redundant API calls during compose operations
  • Extract account_id() helper: DRY up repeated 3-line pattern across 12 call sites
  • Rename md5_hash → hash_id: Function uses SipHash, not MD5
  • Remove dead_code allow + use Display trait: Cleanup

Remaining (in progress)

  • Extract shared create_and_submit_email helper (~300 lines dedup)
  • Replace hand-rolled XML parsing with roxmltree
  • Replace hand-rolled vCard parsing (line folding, QP encoding)
  • Fix MCP action field bypass (confirmation guard)

Test plan

  • cargo check passes
  • cargo test passes
  • cargo clippy clean

🤖 Generated with Claude Code

radiosilence and others added 5 commits March 26, 2026 16:22
…p ordering, caching

- Check EmailSubmission/set response (fix #1)
- Remove unsafe env var manipulation in tests (fix #2)
- Replace .unwrap() in Output::print (fix #3)
- Cache mailbox list after first fetch (fix #7)
- Fix forward_email body extraction HashMap ordering (fix #8)
- Commit Cargo.lock, remove from .gitignore (fix #9)
- Extract account_id() helper (fix #11)
- Rename md5_hash → hash_id (fix #12)
- Remove dead_code allow, use Display trait (fix #13)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add `mut` to all callers of methods that now require `&mut self`
- Remove unused `sender_display` method and its tests (dead code)
- Let cargo fix remove unnecessary mut bindings
- Zero warnings, all 31 tests pass

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…reply/forward

Shared helper handles: to/cc/bcc address serialization, subject, body,
threading headers, method call building, response parsing. Removes ~80
lines of duplicated code across the three compose methods.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Run cargo fmt to fix all formatting diffs
- Fix clippy too_many_arguments: bundle params into EmailDraft struct
- Fix clippy collapsible_if in carddav parser
- Replace hand-rolled XML parsing with roxmltree (fix #5)
- Add vCard line folding and quoted-printable decoding (fix #6)
- Fix QP decoder to handle multi-byte UTF-8 properly
- Add 9 new carddav tests (unfold, QP decode, vCard parsing edge cases)
- All 40 tests pass, zero warnings

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add stateless confirmation_token to send/reply/forward mutations (#10)
  PREVIEW returns hash-based token, CONFIRM/DRAFT require it
- Replace hand-rolled XML with roxmltree for CardDAV (#5)
- Add vCard line unfolding + quoted-printable decoding (#6)
- 9 new carddav tests, all 40 tests pass
- Update changelog with all remaining fixes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@radiosilence radiosilence merged commit 1d4e499 into main Mar 26, 2026
3 checks passed
@radiosilence radiosilence deleted the polecat/obsidian/fc-xym@mn7o6rrl branch March 26, 2026 16:46
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