Skip to content

Mail relay: links to an install's own domain once CoderHelm proves it over HTTPS - #325

Merged
nambok merged 1 commit into
mainfrom
feat/relay-custom-domain
Oct 27, 2026
Merged

nambok merged 1 commit into
mainfrom
feat/relay-custom-domain

Conversation

@nambok

@nambok nambok commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Emails sent through CoderHelm's mail relay can now link to a self-hosted install's own custom domain, once that domain is proved. Until now, links could only go to the install's CloudFront address or its CoderHelm name, so installs on their own domain had to use SES. Follow-up to #315.

Changes

  • POST /hybrid/email/domain (signed, verified, non-revoked install, rate limited): the install names its domain. The relay fetches https://<domain>/webhooks/relay/proof with the no-redirect, size-capped install client and checks the install's signed proof. That succeeds only when DNS points at the install and its certificate is valid. The relay records the hostname and verified_at under the install (EMAILDOMAIN) and writes an audit line.
  • relay::link_hosts: links may point at the CloudFront address, the CoderHelm name, and the custom domain only while its proof is under 7 days old. relay::custom_domain_ok refuses CoderHelm's zone, AWS addresses, IPs and malformed names.
  • Install side (common::mail): when the relay refuses a link (link_not_own_host) and the install's address is its own domain, the install asks the relay to prove the domain, then retries once. It never falls back to SES.
  • Deliveries reason codes and docs (email.md, hybrid.md threat model) updated.

Verification

  • cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace (2225 pass, including no_hosted_urls).
  • New tests:
    • an_unverified_custom_domain_link_is_still_refused: unverified, refused; verified, allowed; another domain, still refused.
    • a_custom_domain_counts_only_while_its_proof_is_recent: stale and future-dated proofs don't count.
    • only_a_real_domain_outside_aws_and_coderhelm_can_be_asked_for.
  • No AWS writes.

… over HTTPS

An install on its own custom domain can now send email through CoderHelm with
links to that domain. The relay accepts the domain only after it reaches the
install there over HTTPS (DNS and certificate working) and gets the install's
signed proof back, the same proof as for its CloudFront address. The proof
counts for a week. The install asks again by itself when the relay refuses a
link. An unverified, stale or look-alike domain is still refused.
@nambok
nambok merged commit cd60158 into main Oct 27, 2026
8 checks passed
@nambok
nambok deleted the feat/relay-custom-domain branch October 27, 2026 04:12
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