Masked email: rewrite to the owner at RCPT TO, create responses carry the address, admins query all masks (ME-4, ME-9, ME-13, ME-19)

Found by running system_tests, which masked email no longer stops:
- rcpt_resolve rewrites a live mask to its owner's address, so
  Delivered-To names the account; delivery recognizes the mask from the
  original recipient when it belongs to that account.
- x:MaskedEmail/set create responses carry the server-set email.
- x:MaskedEmail/query returns every mask to a server-level impersonate
  holder, and filters on accountId.
- The refusal for an unlinked emailDomain uses upstream's wording.
- The shared delivery test checks the fork's address format (ME-13).
- The masked email test's tenant domain uses manual DKIM, so its cleanup
  leaves nothing behind.
This commit is contained in:
2026-09-18 18:29:19 -07:00
parent f58aea000f
commit 4a9aa9c548
7 changed files with 160 additions and 35 deletions
+17 -1
View File
@@ -130,7 +130,7 @@ impl MailDelivery for Server {
for rcpt in message.recipients {
// inbuxa: ME-4, ME-10: a masked address delivers to its owner
let mask = match inbuxa_features::masked_email::ops::resolve_recipient(
let mut mask = match inbuxa_features::masked_email::ops::resolve_recipient(
&self.core.storage.data,
self.registry(),
&rcpt.address,
@@ -177,6 +177,22 @@ impl MailDelivery for Server {
continue;
}
};
// inbuxa: ME-9: rewritten at RCPT TO, the mask is the original recipient
if mask.is_none() {
match inbuxa_features::masked_email::ops::resolve_original(
&self.core.storage.data,
self.registry(),
rcpt.orcpt.as_deref(),
account_id,
)
.await
{
Ok(original) => mask = original,
Err(err) => {
trc::error!(err.span_id(message.session_id));
}
}
}
if let Some(status) = account_ids
.get(&account_id)
.and_then(|pos| result.status.get(*pos))