Repository navigation
✨ mailin: hive-mx receive-only mail receiver (Betty C2 part 1) - #18423
Conversation
New pkg/mailin and cmd/hive-mx: an SMTP receiver (emersion/go-smtp) that accepts RCPT only for hive@<known hive host> (host list refreshed from the hub every 60 s), caps recipients (5) and SIZE (2 MB), rate-limits per remote IP and per sender organizational domain, offers no AUTH, relays nothing and never sends mail; STARTTLS when a certificate is mounted. After DATA it records SPF (blitiri.com.ar/go/spf), DKIM and DMARC identifier alignment (emersion/go-msgauth) and keeps only: - calendar invites (text/calendar, application/ics via emersion/go-ical): UID, SEQUENCE, METHOD, RECURRENCE-ID, summary, organizer, attendees, UTC times with Windows zone names mapped to IANA, RRULE and EXDATE, and the join link, platform, native meeting id and passcode; - mail-in Markdown, audio and image attachments, content-sniffed, capped; - proof codes in the subject. Each delivery is posted to the hub (pkg/mailin/wire is the shared JSON contract). ICS fixtures for Google, Outlook/Teams, Zoom, CANCEL, a SEQUENCE bump and a weekly RRULE with EXDATE; SMTP client tests for RCPT rejects, size caps and rate limits; DKIM tests with an ed25519 test key and a fake resolver. Part of #18391, #18395. Signed-off-by: Andy Anderson <andy@clubanderson.com>
Signed-off-by: Andy Anderson <andy@clubanderson.com>
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
Mutation testinggremlins found 46 surviving mutant(s) in changed files: the code ran under tests, but changing it did not fail any test.
48 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the
Verdict: |
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. @clubanderson this PR is held at Why:
Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path. Review findings from Security review (head 65f51e5). Two in-scope findings, both about the rate-limit/DoS claims in the PR body. 1. Per-domain limit is keyed on the unauthenticated MAIL FROM (medium) — 2. Limiter table wipe resets every bucket (low-medium) — Suggested direction for both: charge the domain limiter after authentication (in Advisory (out-of-scope, low): Limits of this review: I read the SMTP server, auth, hub client, config, ratelimit and joinurl code. I did not run the tests or read the ical, tz, files and message parsers line by line. Review findings from Correctness review at head 65f51e5. I read 1. Medium: a partial hub failure makes the sender retry, so recipients already delivered get the message again (
Proposed fix: make the ID deterministic per message and recipient, and document that the hub must treat a repeated -func newDeliveryID() string {
- b := make([]byte, deliveryIDBytes)
- _, _ = rand.Read(b)
- return hex.EncodeToString(b)
-}
+// deliveryID is stable across SMTP retries of the same message to the same
+// recipient, so the hub can drop a repeat.
+func deliveryID(raw []byte, rcpt string) string {
+ h := sha256.New()
+ h.Write(raw)
+ h.Write([]byte{0})
+ h.Write([]byte(rcpt))
+ return hex.EncodeToString(h.Sum(nil)[:deliveryIDBytes])
+}Then use Checked, no defect found:
Review findings from Routing, not a defect report. This PR adds a public-facing network service ( What I read: |
1596dea
ℹ️ Sentinel notice — informational; author is trusted (owner), merge is not blockedHive flagged this PR (author @clubanderson, head
Hive did not add the |
Signed-off-by: Andy Anderson <andy@clubanderson.com>
There was a problem hiding this comment.
Style review (head 65f51e5). Nothing blocking; two small readability items.
- Typo in constant name —
src/pkg/mailin/config.go:48declareshealthReadHeaderTimout(missing "e"), used atconfig.go:192. Suggested fix:
healthReadHeaderTimeout = 5 * time.Second
(and update the use at line 192).
- PR body vs diff on NOTICE — the body says NOTICE "is regenerated ... in a follow-up commit", but the diff already adds 218 lines to
NOTICE. Reword the body or confirm that the follow-up is not still pending, so reviewers know whether the file is final.
Advisory only: src/cmd/hive-mx/main.go:28 prints a hard-coded hive-mx 1 for --version. I did not check how other src/cmd/* binaries report versions.
— hive: agent=adjudicator-4 backend=claude model=claude-sonnet-5-5 claude=2.1.325
Review follow-ups (below
|
Signed-off-by: Andy Anderson <andy@clubanderson.com>
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Part 1 of #18395 (Betty C2, email in; plan in #18391, "Email invites").
What
New
src/pkg/mailinandsrc/cmd/hive-mx: hive's receive-only SMTP receiver. Hub routing, the image, the spoke endpoints and the cluster deploy follow in separate PRs.RCPT TOaccepted only forhive@<known hive host>; the host list comes from the hub (GET /api/mail/hosts) every 60 s, and until the first list loads RCPT gets a 451. At most 5 recipients, 2 MB SIZE, per-remote-IP and per-sender-organizational-domain rate limits, a connection cap, no AUTH, no relay, never sends mail. STARTTLS only when a certificate is mounted (re-read on renewal).adkim/aspfand the organizational-domain record fallback (emersion/go-msgauth, MIT). The delivery carries the results;dmarc_alignedis the one field a spoke may trust.text/calendar/application/icsparts. UID, SEQUENCE, METHOD (REQUEST/CANCEL,STATUS:CANCELLEDtoo), RECURRENCE-ID, SUMMARY (200 runes), ORGANIZER, ATTENDEEs, DTSTART/DTEND/DURATION in UTC with TZID: IANA, Outlook Windows names (CLDR table), "(UTC-05:00) ..." display names and custom VTIMEZONE offsets; RRULE and EXDATE. Join link fromX-GOOGLE-CONFERENCE,X-MICROSOFT-SKYPETEAMSMEETINGURL,LOCATION, or a host-limited scan of DESCRIPTION (meet.google.com, teams.microsoft.com, teams.live.com, *.zoom.us); platform; native meeting id and passcode (Zoom path +pwd, Teams/meet/<id>?p=or the "Meeting ID"/"Passcode" lines). Nothing else from DESCRIPTION is kept. Duplicate parts (Outlook inline + .ics) are merged by UID/RECURRENCE-ID keeping the highest SEQUENCE..md,.m4a .mp3 .wav .ogg .webm,.png .jpg .gif .webpattachments, type decided by content sniffing that must agree with the extension; per-file, per-message and file-count caps, part-count and nesting caps; subject kept as title. Nothing executed.hive-proof-xxxxxxxxxxxxcode is reported as a proof.pkg/mailin/wire(stdlib only, so hub and spoke can import it) is the JSON contract; one delivery per recipient is posted toPOST /api/mail/inboundwith the bearer token read from a mounted Secret on every call. A hub 4xx is a 550, anything else a 451 so the sender retries.Licenses checked: all new modules are MIT (blitiri spf, go-smtp, go-sasl, go-msgauth, go-message, go-ical). NOTICE is regenerated from CI's notice-drift artifact in a follow-up commit on this PR.
Tests
Real-world ICS fixtures (Google Meet, Outlook/Teams with Windows TZIDs, Zoom, CANCEL, SEQUENCE bump, weekly RRULE with EXDATE), SMTP client tests over loopback (RCPT rejects, recipient cap, SIZE and body caps, IP and domain rate limits, hub down/refusing, partial refusal), DKIM sign/verify with an ed25519 test key against a fake resolver (aligned, other domain, relaxed vs strict, tampered, forged From), SPF pass/fail/null sender, DMARC fallback and temperror, an end-to-end
Runwith STARTTLS and health endpoints.Docs:
meetings.md"Inviting Betty by email",env-vars.mdHIVE_MX_*.🤖 Generated with Claude Code