# Security notes How Mailflare handles attachments, sender checks, webhooks, forwarding and app passwords. For admins who assess or operate an installation. ## Attachments **Mailflare has no antivirus.** It blocks one-click downloads of files that are risky by design: - SES and Resend mail flagged as infected is dropped. - Files are judged by name and type: programs, scripts, macro-enabled Office files, double extensions (`invoice.pdf.exe`), hidden text-direction characters, and files that can hide others (HTML, SVG, disk images, archives). - ZIP files are checked without unpacking, by reading file names (at most 1000 entries and 1 MiB). Password-protected or unreadable archives are flagged. - A flagged file shows reasons. Download stays off until the user ticks **I understand the risk**. The server answers direct downloads without that with HTTP 409. It cannot find malware in a normal-looking PDF or image. Add ClamAV or a provider scan in front of the server if you need that. ### Deleted attachments stay in the original message Deleting an attachment removes the stored file, so it cannot be downloaded, previewed or shared. The original message is not rewritten: **Download original** and the JMAP raw file still contain it. **Delete the whole message** to remove it. Public share links stop working when the message goes to Trash or Spam, or the mailbox is disabled. They also expire. ## Sender authentication (SPF, DKIM, DMARC) | Receiving path | Source of results | | --- | --- | | Cloudflare | The `Authentication-Results` header written by `mx.cloudflare.net`. Any failure beats a pass. | | SES and Resend | The provider's verdicts | | Self-hosted SMTP | Mailflare checks them itself. If DNS takes over 10 seconds, there is no result and mail is delivered. | The SMTP listener never trusts authentication or `Received` headers written by the sender. It refuses unmanaged domains before accepting the message. ## Webhooks - URLs must be `https://` on a public host. Redirects are not followed. Old hooks are checked again at delivery. - Spam and Trash mail does not trigger `message.inbound`. - A webhook copies mail content out. Creating one, changing its URL, adding events or re-enabling it asks you to confirm your identity. Disabling it or rotating its secret does not. ## Forwarding loop protection Forwarded mail carries `X-Mailflare-Forwarded`, signed with a server secret (`CF_TOKEN`, `CF_API_KEY` or `INBOUND_WEBHOOK_SECRET`) over the Message-ID and From address. A sender cannot add or copy it to stop forwarding. With none of those secrets, the value is `1`. ## App passwords An **app password** lets a mail or calendar app sign in without your password or second step. Manage them under **Settings → App passwords**, which shows last use, protocol and IP, and revokes at once. ### Create and limits - Creating one needs a fresh identity check (password plus code, or passkey). So does an API key with the `jmap` scope. - 16 random characters, shown once, stored only as a SHA-256 hash. - Limited to chosen protocols (today JMAP) and mailboxes. It cannot open the web app or call `/api`. - Exception: the mobile routes `/api/mobile/push` and `/api/mobile/avatar` accept the `jmap` scope, without the HTTPS check or guess limit. ### HTTPS - HTTP Basic sign-in never accepts your account password. CalDAV/CardDAV and the IMAP helper accept app passwords only, over HTTPS. - **JMAP Basic sign-in still works over plain HTTP** (for old LAN and Docker clients). Use a TLS proxy with `TRUST_PROXY` to protect the key. - Behind a proxy, set `TRUST_PROXY` so `X-Forwarded-Proto: https` is trusted. - The helper allows plain HTTP only from the same machine, with `Host` `localhost`, `127.0.0.1` or `[::1]`. A local proxy without `TRUST_PROXY` is refused unless it forwards that host. ### Guess limits - Wrong guesses are limited per client IP (IPv6 by /64); without a known IP, per key. - **No limit applies** without the rate-limit binding `DEVICE_LOGIN_RATE_LIMIT` or `LOGIN_RATE_LIMIT`. - Bearer tokens are not rate limited. ### Calendar and contacts sync - CalDAV and CardDAV (`/dav/*`, `/.well-known/caldav|carddav`) are off until an admin enables them under **Admin → General**. While off, they return 404. - Only app passwords with **Calendar and contacts**, over HTTPS (HTTP gets 403). - XML bodies: 256 KiB max; DOCTYPE and processing instructions are refused. - 600 requests a minute per password (then 503 with `Retry-After`). - **This release answers discovery only.** Calendars and address books are not served yet. ### When keys are revoked Changing or resetting the password, changing two-step sign-in, an admin reset, or **Sign out everywhere** deletes every key: app passwords, mobile, API, MCP and admin keys, and calendar links. Sends waiting for approval from those keys are cancelled. Creating a key that reaches mail or administers the install needs a fresh identity check. ## Related - [API](api.md) - [Spam protection](spam-protection.md) - [Report a vulnerability](../.github/SECURITY.md)