fix(router): deliver automated posts, stop robots from confirming subscriptions

- discardReason drops only the own-List-Id loop, Auto-Submitted: auto-replied and Precedence: auto_reply; auto-generated, auto-notified and unknown values take the normal path (membership, From, moderation)
- join, leave and confirm commands ignore (250, token kept) a null sender, any Auto-Submitted other than no, Precedence auto_reply/bulk/junk and the list's own List-Id
- tests: loop_test, new auto_test, ingest LMTP test
- README: loops and robots paragraph in the security notes
This commit is contained in:
tgiachi 2026-11-10 11:54:00 +01:00
commit 9a64146fce

View file

@ -249,6 +249,13 @@ lists.example.org lmtp:inet:127.0.0.1:2424
and `Reply-To` come from the header; so a post whose header names someone else (or has no usable `From`, or several
addresses) is held for moderation instead of delivered, with the reason shown to the admin (API, CLI, UI). Let Postfix
reject forged senders too (SPF, DKIM, DMARC checks on inbound mail).
- **Loops and robots.** Mail that carries the list's own `List-Id` (a loop) or is a genuine auto-reply
(`Auto-Submitted: auto-replied`, `Precedence: auto_reply`) is answered `250` and dropped without a trace, so the
sender's server never bounces it. Other machine-generated mail (`Auto-Submitted: auto-generated`, cron, CI and
monitoring posts) is a normal post: the membership, `From` and moderation checks apply. The `join`, `leave` and
`confirm` addresses ignore (`250`, nothing happens, the token is kept) a mail with a null sender, any
`Auto-Submitted` other than `no`, a `Precedence` of `auto_reply`, `bulk` or `junk`, or the list's own `List-Id`.
This stops an auto-responder from confirming a subscription someone forged in your name.
- **The moderation queue is bounded.** A list holds at most 500 messages and 200 MiB, and one held message at most 10 MiB; a
full queue answers `452` (the sender retries later), a message over 10 MiB `552`. Messages nobody moderated for 30 days
are dropped. Listings (API, CLI, UI) show a summary and never read the bodies. The held view shows the From header