The ep-mail story: a mail client that assumes the worst

ep-mail is a desktop (Windows, Linux) and Android mail client from the Eternity Project. It started as a clean, pleasant IMAP/SMTP client. It became a project about one question: what should a mail client refuse to do, even when asked nicely by a message?

Email is the oldest untrusted input on the internet. Anyone can send you HTML, images, links and attachments. A mail client reads all of it, holds your passwords and, with OpenPGP, your private keys. So ep-mail treats every incoming message as hostile and every secret as something to keep away from the part of the app that touches hostile content.

Chapter 1 – Split the app in two

The desktop app has two sides:

Side Does Never does
Main process (desktop/main.cjs) Network (IMAP/SMTP/CalDAV/CardDAV, key servers), crypto, secret storage, native dialogs Render mail
Renderer (www/) Shows the UI and sanitised mail Touch the network, keys or passwords directly

They talk over a narrow preload bridge. If a malicious message ever got script running in the renderer, it would find a small API and no secrets. The decisions that matter (trust changes, key replacement, sending unencrypted, opening links) are made in the main process behind native confirmation dialogs that a web page cannot click.

Chapter 2 – Secrets at rest

Mail credentials, DAV credentials and PGP keys live in mail-account.enc, dav-accounts.enc and pgp-keys.enc, wrapped with the operating system's secure storage (Electron safeStorage: DPAPI on Windows, Keychain/libsecret on desktop Linux). On Linux the weak basic_text fallback is refused rather than silently accepted. Private PGP keys are additionally protected by a passphrase; changing it is copy-on-write, so a failure cannot destroy the only copy of a key.

Chapter 3 – A message is not allowed to phone home

A message with a tracking pixel and a script. The script is gone, the image is held back, and the user is told why.

The message above is a typical phishing/tracking mail. It contains a script, a tracking pixel and a look-alike link. ep-mail's behaviour:

  • Incoming HTML goes through an allowlist sanitiser. Scripts, styles, forms, frames, SVG, event handlers and inline styles are removed. The link target is stripped; links open only after a native confirmation.
  • Remote images are blocked by default. The banner explains the cost: loading them reveals your network address and that you opened the message.
  • Only HTTPS images are accepted, and only when you press Load images for this message. The choice is per message and per view; reopening the message blocks them again.
  • A Content-Security-Policy blocks scripts, frames, forms and connections as a second line of defence.

Chapter 4 – OpenPGP without blind trust

ep-mail generates Curve25519 keys and interoperates with GnuPG (encrypt, sign, PGP/MIME, inline PGP). The hard part of encrypted mail is not the maths but trust, so that is where the design is strictest:

  • Key lookup never raises trust. Keys found through WKD, VKS or HKP are stored as untrusted until you verify the fingerprint out of band.
  • Key servers are opt-in. All are disabled by default and enabled one by one. Custom servers must be HTTPS and need a native confirmation; redirects and oversized responses are rejected.
  • Publishing is explicit. Uploading a public key requires a confirmation naming the destination. Only public key material is ever sent.
  • No quiet replacement. If a different key appears for an address you already have, both fingerprints are shown and you must confirm.
  • No silent downgrade. If a recipient should be encrypted and a key is missing, the send is stopped in the main process, not just in the UI. Messages queued while offline are stored as ciphertext.

The companion project ep-docker-gpg-keyserver provides a self-hostable Nginx + Hagrid stack for the other end of this: WKD under /.well-known/openpgpkey/, HKP at /pks/lookup, and VKS at /vks/v1/. Its README is candid about the limits: HKP upload does not verify email ownership (prefer VKS), and TLS and SMTP are left for you to configure.

Chapter 5 – Being reviewed, and fixing what was found

The project went through AI-assisted security reviews (recorded in SECURITY_REVIEW.md). They found five medium-severity issues, and all were fixed:

  1. Sending before a key lookup finished could send the message unencrypted.
  2. A compromised renderer could have raised key trust.
  3. Replacing an existing key was not confirmed.
  4. The plaintext-downgrade check lived only in the renderer.
  5. Linux could fall back to the plaintext basic_text secret backend.

No critical or high findings were reported. This is an AI review, not a substitute for an independent human audit.

Chapter 6 – Shipping it

Releases are built for Windows (installer and portable), Linux (AppImage and .deb) and Android (APK), published with a SHA256SUMS file so downloads can be verified. On Windows, the installer and the per-user Start Menu shortcut are given the app's identity so the correct icon appears on the taskbar and pin menu. See the releases page.

Honest limits

  • The Android APK is a debug build and does not include the desktop's OpenPGP and secure-storage features.
  • Key trust is manual by design. That is safer, and more work for you.
  • Remote-image blocking protects privacy; it cannot make a phishing link trustworthy. Read the real address in the confirmation dialog.
  • The screenshot above uses the built-in demo UI with an invented sample message, not real mail.

Further reading

https://git.eternityproject.fi/thuttu/ep-mail-client