EmailFilter makes outgoing DNS, SMTP, RDAP and WHOIS connections based on the addresses it is given, and its API can change lists and scores. Decide who may call it.
API key
Set EMAILFILTER_API_KEY to at least 16 characters, for example openssl rand -hex 32. Every endpoint except /healthz then needs it:
curl -H "X-API-Key: $KEY" -X POST http://localhost:8000/filter-email -d '{"email":"a@example.com"}'
Authorization: Bearer <key> works too. Without a key EmailFilter logs a warning at startup.
Network exposure
The Compose file publishes the port on 127.0.0.1 only. Keep it there when the callers run on the same machine, or put EmailFilter on a private network. If it must be reachable from the internet, set an API key and put it behind your reverse proxy with HTTPS.
Rate limits and proxies
Each client IP may make EMAILFILTER_RATE_LIMIT requests per minute (120 by default); more get HTTP 429. Behind a reverse proxy, set EMAILFILTER_TRUST_PROXY to the proxy's address so the limit applies to real clients. X-Forwarded-For from anyone else is ignored.
Spam reports
POST /feedback/spam lowers a domain's score for everyone. Only let trusted applications call it, and reset a domain hit by false reports with DELETE /reputation/{domain}.
Outgoing connections
The checks refuse to connect to private, loopback, link-local and other non-public addresses, after DNS resolution, so a domain that resolves to 10.0.0.5 or 169.254.169.254 gets nowhere.
The container
The image is distroless, with no shell or package manager, and runs as a non-root user. The Compose file adds a read-only root filesystem, drops all capabilities, sets no-new-privileges and limits memory and processes.
Postfix policy service
The policy port has no authentication, as Postfix sends none. Bind it to localhost or a private network.
Reporting a vulnerability
Please use a private security advisory on GitHub rather than a public issue. The security policy lists what is in scope.