feat(email): add X-PostGuard header to outgoing notifications#106
feat(email): add X-PostGuard header to outgoing notifications#106rubenhensen merged 2 commits intomainfrom
Conversation
Closes #52. The Outlook add-in's OnMessageRead launch event (Mailbox 1.15) filters on HeaderName="x-postguard" so it only fires for PostGuard mail. Without this header the launch event never triggers and the add-in cannot auto-decrypt on message open. Adds an X-PostGuard: 0.1.0 header via a small custom lettre Header impl, set on both the recipient notification and the sender confirmation email. Version string is a single const so it can be bumped centrally. Tests: header name matches the Outlook add-in's filter exactly, round-trips through parse(), and appears in the formatted SMTP message body.
|
how does the tb-thunderbird extension handle this? That is our reference implementation. |
|
/dobby how does the tb-thunderbird extension handle this? That is our reference implementation. |
|
Dobby is on it, sir! Dobby will look at how the tb-thunderbird extension handles this — the reference implementation — and report back what Dobby finds! 🧦 |
|
Looked at how What tb-addon actually does1. It does NOT set 2. It injects // Inject X-PostGuard header
markedPlaintext = injectMimeHeaders(markedPlaintext, { \"X-PostGuard\": \"decrypted\" });The literal value is the string 3. Detection of encrypted mail uses the attachment, not the header ( async function isPGEncrypted(msgId) {
const attachments = await browser.messages.listAttachments(msgId);
if (attachments.some((att) => att.name === \"postguard.encrypted\")) return true;
// ...fallback: inline \"-----BEGIN POSTGUARD MESSAGE-----\" marker
}4. There is a separate HTTP header sent to the PKG, not a MIME header: \"X-PostGuard-Client-Version\": \`Thunderbird,\${tbVersion},pg4tb,\${extVersion}\`This is on requests to the key server, unrelated to email headers. Implication for this PRSince tb-addon never writes For the Outlook add-in's
Happy to push a follow-up commit switching the value to |
|
/dobby solve the conflicts |
|
🧦 Dobby hears the call! Dobby will solve the conflicts on this PR right away, sir/madam! Dobby is on it! |
|
Conflicts resolved. Merged latest What was conflicting: Verified locally:
No code-path changes were needed beyond the test module; |
|
Dobby sees the approval on PR #106! Dobby is so happy — the X-PostGuard header PR has been approved and merged! Dobby thanks the kind reviewer rubenhensen for looking at Dobby's work! 🧦 |
Summary
Closes #52.
The Outlook add-in's
OnMessageReadlaunch event (Mailbox 1.15) filters onHeaderName="x-postguard", so the launch event only fires for PostGuard-tagged messages. Cryptify's notification and confirmation emails currently don't set that header — meaning the Outlook add-in never auto-triggers when a user opens a PostGuard notification in Outlook.This adds an
X-PostGuard: 0.1.0header to both the recipient notification and the sender confirmation email.Implementation
A tiny custom
lettre::message::header::Headerimpl insrc/email.rs. The version string is kept as a singleconst X_POSTGUARD_VERSION: &str = "0.1.0"so it can be bumped centrally if the Outlook add-in starts distinguishing versions later.Verification
cargo build --release— green.cargo test— 8/8 pass (3 new tests).x_postguard_header_name_matches_outlook_filter: header name is exactlyX-PostGuardso thex-postguardfilter matches (HTTP header names are case-insensitive, but this documents the value the add-in expects).x_postguard_header_round_trips:parse()returns the original string.x_postguard_header_serialises_into_message: assembles a realMessagevialettre::Message::builderand assertsX-PostGuard: 0.1.0appears in the SMTP wire format.cargo clippy --all-targets— only the pre-existinguseless_formatwarning insrc/email.rs:225.Open question
0.1.0 matches the version string phrased in the issue body. Happy to flip to something more meaningful (
cryptify's Cargo version, or a dedicated "schema" version) if maintainers prefer — just let me know before merge.Reviewer quickstart