Security

Security

Security

Postern's threat model, its trust boundaries, how sign-in is protected, how to report a vulnerability and how to verify releases.

A Hub holds the keys to every mailbox of its users. This page explains what Postern protects against and what it does not, who has to be trusted for what, and how sign-in is protected. The other pages in this section go into detail:

To report a vulnerability, see Reporting a vulnerability.

What Postern protects #

  • Your mailbox credentials: passwords, app passwords and OAuth tokens for your providers.
  • Your mail: message bodies, attachments and the raw messages the Hub keeps.
  • Your Hub account: password, second factors, sessions.
  • As far as possible, who you write with: by keeping push notifications content-free if you want, and by loading remote images through a proxy.

Threat model #

Threat Main defenses
Someone on the network tries to get into the Hub Few public endpoints, rate limits on every sign-in path, passkeys and TOTP, step-up for sensitive changes, CSRF protection, no CORS, strict security headers. The default listen address is 127.0.0.1.
A stolen disk, VM snapshot or backup of the data folder Credentials, message bodies and attachments are encrypted with keys that come from a separate key file, which backups never contain. The key file can be sealed with a passphrase.
Hostile email (scripts, tracking pixels, phishing overlays, attempts to make the Hub probe your network) The Hub cleans HTML with an allow-list, apps render it with scripts off and a strict Content Security Policy, remote images go through a proxy that refuses private addresses, known trackers are removed.
A lost or stolen phone or computer Every app is a device you can revoke in Settings → Devices. Revoking ends its session at once; the app wipes its local data and keys the next time it reaches the Hub. Tokens on the device sit in the system's secure storage.
The push relay, Apple or Google reading notification text Previews can be turned off, then pushes carry no sender, subject or text. The relay stores nothing about messages.
A tampered download Releases are planned to be signed with cosign and to ship checksums and SBOMs. See Verifying releases.

Out of scope #

  • Root on the running Hub machine. The Hub has to hold its keys in memory while it runs, so someone with root on that machine can read everything.
  • A malicious Hub admin. On a shared Hub, the admin controls the machine and the key file and can ultimately read other users' data. Only use a Hub run by someone you trust.
  • A compromised mail provider. Your provider has your mail anyway.
  • Metadata on the Hub. Subjects, addresses, dates and the search index are stored without application-level encryption; use disk encryption if that matters to you (see Encryption at rest).
  • Bugs in browsers or operating systems that break their own sandboxes.

Trust boundaries #

Party What it has What you trust it with
The Hub (and whoever runs its machine) The master key, every user's data key, mailbox credentials, the mail it keeps. Everything. It is the center of the system.
The apps (web, desktop, iOS, Android) A revocable session. Desktop and mobile apps that connect to providers directly also get the mailbox credentials from the Hub (after you approve the device) and keep their own copy of mail. Your mail and credentials on that device, protected by the system's secure storage and the device's own security.
Mail providers (Gmail, Microsoft, IMAP servers, ...) Your mail. They see the Hub's IP address (and, in direct mode, your device's). What they already have. Postern never sends them more than a mail client must.
The push relay Device push tokens and, with previews on, sender, subject and first words, for the moment it forwards them. Stores only Hub registrations. Not reading or keeping notification text. With previews off you do not need to trust it with any mail content. See What the relay sees.
Apple and Google push services Whatever the relay forwards. The same as the relay.
Your reverse proxy or tunnel (Caddy, nginx, Traefik, Tailscale, Cloudflare Tunnel) All traffic in clear text, if it terminates TLS. Everything that passes through it, including session tokens. Run it yourself or pick a provider you trust.
Cloudflare (if you use Cloudflare Tunnel) Terminates TLS for your Hub's public address, so it sees all traffic in clear text, including mail you open in the web app. The same as a reverse proxy. Cloudflare Access adds a second lock in front of the Hub. See Cloudflare Tunnel.
Remote image hosts The IP address that fetched the image (your Hub's, or your device's in direct mode) and the fact that you opened the mail. Nothing, as long as images stay blocked for senders you do not know.

Sign-in protections #

Passwords and second factors #

  • Passwords must be at least 10 characters. They are stored as Argon2id hashes (64 MB of memory, 3 passes).
  • Two-step verification: TOTP codes from an authenticator app, with one-time recovery codes, and passkeys (WebAuthn). Passkeys need the Hub to be opened over HTTPS with POSTERN_PUBLIC_URL set. Both are set up under Settings → Security.
  • Single sign-on (OIDC) is available if the admin configures it. See Sign-in methods.
  • Registration is By invite or Closed (Settings → Admin → Your Hub → New accounts). There is no open sign-up.

Rate limits #

The Hub limits every sign-in path. The limits are token buckets kept in memory: a burst is allowed, then attempts refill at a fixed rate. They reset when the Hub restarts.

What Counted per Burst Refill
Sign-in attempts Client IP 20 1 every 15 seconds
Failed password or code (lockout) Account 5 1 every minute
Pairing claims Client IP 10 1 every 30 seconds
Registration and first setup Client IP 5 1 every minute
Other public sign-in endpoints (invite lookups, app sign-in tokens, passkey steps) Client IP 30 1 every 5 seconds
Turning on TOTP User 5 1 every minute

Over a limit, the Hub answers "Too many attempts. Please wait a moment and try again." with HTTP 429 and a Retry-After header. A successful sign-in resets the account's counter.

The client IP is the connection's address, unless POSTERN_TRUST_PROXY is on and the request comes from one of POSTERN_TRUSTED_PROXIES. Behind a reverse proxy, turn trust on, or every client shares the proxy's address and its limits. See the Hardening checklist.

Step-up for sensitive changes #

Some actions ask you to prove again that it is you, even though you are signed in:

  • changing your password, or setting a first password on an account that has none;
  • changing your sign-in email;
  • turning off two-step verification;
  • deleting your account;
  • approving a device that will fetch your mailbox credentials (pairing, or signing in an app through the browser).

Accounts with a password confirm with the password. Accounts without one confirm with a TOTP code, or count as confirmed if they signed in on this session within the last 10 minutes. Otherwise the Hub answers "For your security, please confirm it's you: sign out, sign in again and retry within 10 minutes." Wrong passwords and codes count toward the account lockout above.

Sessions and devices #

  • A session is a random 32-byte token. The Hub stores only its hash, so a copy of the database cannot be used to sign in.

  • The web app and the desktop app get an HttpOnly cookie (mc_session, SameSite=Lax, Secure over HTTPS). Mobile apps send the token as a bearer token and keep it in the iOS Keychain or Android Keystore.

  • Sessions slide: 30 days after the last use for web and desktop, 90 days for iOS, Android and Apple Watch.

  • Every signed-in app is a device in Settings → Devices, where you can rename or revoke it. Revoking ends the session immediately.

  • Changing your password signs out your other devices.

  • New devices sign in through the Hub's own sign-in page in the system browser, or by pairing: a code valid for 5 minutes that a signed-in device has to approve.

  • An Apple Watch is signed in by the iPhone app it pairs with, as a companion of that phone. The phone asks the Hub directly with its own session, so no other device is asked to approve it, and no recent password is needed. In return the watch gets less than any other device:

    • it never receives mailbox credentials (the credentials vault refuses it);
    • it has no recent sign-in of its own, so sensitive changes ask it for your password;
    • it is signed out together with its phone, whether the phone is signed out, revoked from another device or its session runs out.

    It is listed in Settings → Devices as "Apple Watch" next to its phone, and the security log records "Apple Watch connected by" the phone's name. A web browser session cannot create companions.

  • Settings → Security → Recent security activity lists sign-ins, failed sign-ins, pairings, revoked devices and changes to passwords and two-step verification.

The web surface #

  • CSRF: every state-changing /api/ request must carry the X-MC-Client header, which a browser cannot send cross-site without a CORS preflight, and the Hub never answers preflights. Requests with an Origin header must also come from the Hub's own origin.
  • Headers on every response: X-Content-Type-Options: nosniff, Referrer-Policy: no-referrer, X-Frame-Options: DENY, Cross-Origin-Opener-Policy: same-origin, Permissions-Policy: camera=(), microphone=(), geolocation=(), payment=(), and Strict-Transport-Security over HTTPS.
  • Content Security Policy on every HTML page, with script-src 'self' and no inline scripts. See How mail is shown safely.
  • Outgoing requests for Web Push, UnifiedPush, remote images, rule webhooks and autodiscovery refuse loopback and link-local addresses (cloud metadata), and most refuse private networks too.
  • Development mode (POSTERN_DEV) relaxes several of these checks. Never use it on a Hub that others can reach.

Reporting a vulnerability #

Please do not open a public issue for security problems. Use GitHub's private vulnerability reporting: on the repository, go to Security → Advisories → Report a vulnerability.

Include what is affected (Hub, push relay, web, desktop or mobile app) and the version, steps to reproduce, the impact as you see it, and whether you want to be credited. Remove real mail content, passwords and tokens from logs first.

The project aims to acknowledge reports within 3 working days and to agree on a timeline within 14 days. The full policy, including what is in and out of scope, is in SECURITY.md.

Verifying releases #

Important

No release of Postern has been published yet, so there is nothing to verify today. If you build from source, you verify the source instead: clone from https://github.com/TheOriUHD/postern and check the commit you build.

The release configuration (.goreleaser.yaml) is set up so that every release will publish:

  • checksums.txt with the SHA-256 checksum of every archive and package;
  • checksums.txt.sig and checksums.txt.pem: a keyless cosign signature of the checksums file, issued to the project's GitHub release workflow;
  • cosign signatures for the container images ghcr.io/theoriuhd/postern-hub and ghcr.io/theoriuhd/postern-relay;
  • an SBOM (software bill of materials) for each archive.

Once releases exist, verify a download like this. First check the checksums file's signature (download checksums.txt, checksums.txt.sig and checksums.txt.pem from the same release):

cosign verify-blob --certificate checksums.txt.pem --signature checksums.txt.sig \
  --certificate-identity-regexp 'https://github.com/TheOriUHD/postern/' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com checksums.txt

Then check the archive against it:

sha256sum -c checksums.txt --ignore-missing

A valid signature plus a matching checksum shows that the archive was built by the project's release workflow on GitHub. Container images are signed by digest; verify them with cosign verify and the same identity and issuer.

Builds use -trimpath and are statically linked (CGO_ENABLED=0).