Security & Deployment
Pigeon is local-first: mail is fetched directly from your IMAP servers, stored in a local SQLite database and served from the same process. There is no cloud middleman and no telemetry.
Credentials at rest
- Account passwords are encrypted with AES-256-GCM.
- The 256-bit key lives in
secret.keyin the data directory, created with mode0600on first start. - Endpoints never return passwords; responses include only non-secret account fields.
- Back up
secret.keywith the database. Without it, stored passwords cannot be decrypted and accounts must be re-added with their passwords.
Mail bodies, subjects and addresses in SQLite are not encrypted — protect
the host with disk encryption if that matters to you. All secret material is
in the data directory; chmod 700 on it is a sensible baseline.
API tokens
- Tokens look like
pigeon_<random>and are returned once, at creation. - Only a SHA-256 hash is stored; a stolen database does not reveal usable tokens.
lastUsedAtrecords the most recent successful authentication.- Revoking a token (
DELETE /api/tokens/{id}orpigeon token delete) takes effect immediately. - The initial token printed by
pigeon serveon first start appears in the log once — treat log files as sensitive.
Authentication model
| Request source | Access |
|---|---|
Loopback (127.0.0.1, ::1) |
Allowed without credentials |
| Anything else | Requires Authorization: Bearer pigeon_… |
GET /api/health |
Public |
The loopback test uses the TCP remote address. Consequences:
- Same-host reverse proxy: a proxy connecting from
127.0.0.1is trusted, so the API is effectively unauthenticated behind it. Either authenticate at the proxy or run Pigeon somewhere its clients are not loopback (for example in a container on a bridge network). - Docker
-p 8787:8787: connections arrive from the bridge gateway, not loopback, so the token is required. This is the intended remote setup. - SSH tunnel / VPN: traffic to
127.0.0.1stays loopback and skips tokens; the tunnel itself provides the access control.
CORS allows any origin by design (the API targets local tools and agents). Authentication still applies to non-loopback requests; do not expose the service to the internet without TLS and a token.
Transport security
- IMAP: implicit TLS, STARTTLS or plain, with a minimum of TLS 1.2 for TLS modes.
- SMTP: TLS is mandatory by default;
tlsuses implicit TLS (SMTPS),starttlsupgrades,nonestill attempts STARTTLS but permits plaintext. - Body fetches use
BODY.PEEK, so reading and syncing never change read state on the server.
Running remotely
By default Pigeon listens on 127.0.0.1:8787, which only this machine can
reach. To let other machines call the REST API (and the /mcp endpoint), bind
a reachable address with --addr or PIGEON_ADDR:
--addr takes precedence over PIGEON_ADDR. Once the service is reachable
from other hosts, every request from them must carry a Bearer token:
This is plain HTTP: the token crosses the network unencrypted. Use it inside a trusted network, or put a TLS-terminating proxy in front before exposing it beyond one.
Recommended patterns, most to least conservative:
- SSH tunnel — keep Pigeon on
127.0.0.1, forward the port over SSH; no public listener at all. - Private network / VPN — bind to a trusted interface with a token.
- Container with port mapping — the Dockerfile runs as a non-root user; non-loopback requests require a token.
- Reverse proxy with TLS — terminate TLS at the proxy and also do authentication there, because Pigeon will trust the proxy’s loopback connection.
What is not encrypted or sandboxed
- HTML mail in the web UI is rendered in a sandboxed iframe (no scripts, no same-origin access) and remote images are blocked until you click “show images” for that message.
- When the web UI talks to a remote server it keeps the API token in browser
localStorage; anyone with access to that browser profile can read it. Prefer dedicated tokens and revoke them when done. - There is no built-in rate limiting; rely on the proxy or network boundary for internet-facing deployments.