MAS-WP-0005-T12: gateway reads trusted A-R verdict; ticket service replies only on DMARC pass

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 252470@bnt-lap001
Assistant-Session: ad628c8f-4be2-4979-94c9-76c7ed6f8241
This commit is contained in:
tegwick 2026-10-18 22:40:30 +02:00
parent ab3346d187
commit cca58d41fb
6 changed files with 128 additions and 13 deletions

View file

@ -393,7 +393,7 @@ never reject on DMARC failure. Milter failure means accept
```task
id: MAS-WP-0005-T12
status: todo
status: done
priority: medium
```
@ -404,6 +404,23 @@ header_from}` into the event. The ticket service gets
sends auto-replies (intake confirmation, closed notice) only when
`dmarc == pass`. Unit tests cover forged A-R headers from other ids.
- 2026-10-18 done:
- `mas_gateway.core.authentication_from_headers` reads only A-R headers
with the trusted authserv-id **above the first Received header**
(RFC 8601 §5). Forged copies below our hop are ignored even if the
MTA did not strip them. Several DKIM results count as pass if any one
passes.
- The event gets `message.authentication = {dmarc, spf, dkim,
header_from}` or null. `--trusted-authserv-id` works on both pipe and
webhook; a JSON webhook passes the provider's verdict through.
- Ticket service `--require-dmarc-pass`: tickets are still created and
mail attached, but replies go out only on `dmarc == pass`.
- Entrypoint: gateway `--trusted-authserv-id $DOMAIN`, ticket service
`--require-dmarc-pass`.
- Tests: own header read; forged (below Received) and foreign ids
ignored; no trusted id gives no verdict; reply gated off without a
verdict and sent on pass. 183 tests pass.
## Live check: authenticated vs forged sender
```task