#26
Harden outbound mail delivery checks
Summary
- reject duplicate SPF and DMARC policies during domain verification, even when one record matches the generated value
- show a specific
Multiple recordsstate with actionable consolidation guidance in domain settings - document the production Cloudflare-over-TLS resolver requirement and its restore verification
- fail the existing Stalwart production check when bogus DNSSEC/DANE events appear in recent logs
Production state
- the Stalwart resolver is already set to Cloudflare DNS with TLS and persisted in the production data volume
- the affected queued messages were rescheduled and accepted by the recipient provider; the queue is empty
- the updated production check helper is installed, currently reports a healthy container and zero recent bogus-DNSSEC events, and retains the prior helper as a rollback copy
Validation
corepack pnpm test— 112 passedcorepack pnpm build— passed with Next.js 16.3.3- ESLint across the changed TypeScript, TSX, and MJS files — passed
bash -n deploy/stalwart/redakt-stalwart-deploy— passedgit diff --check origin/main...HEAD— passed- browser-tested the duplicate-SPF status and recovery copy at desktop and 320px; no horizontal overflow at 320px
Existing limitation
- repository-wide
pnpm lintstill reports the two pre-existing CommonJSrequirefindings inbabel.config.jsandpostcss.config.js; neither file is changed here
Activity
4mikeyreviewed3mo ago
25943a4 into main3mo ago
Review summary
Focused on the SPF/DMARC duplicate-policy detection (
lib/dns/doh.ts,dns-records.tsx), the Stalwart deploy hardening (deploy/stalwart/redakt-stalwart-deploy), and the docs.Correctness of the duplicate-policy detection is solid.
policyConflictinlib/dns/doh.tscorrectly anchors the SPF/DMARC regexes, normalizes chunked/quoted TXT data before comparing, only flags a conflict when more than one answer at the record's own host matches the same policy type, and leaves DKIM/other TXT records untouched. The new tests exercise the "single SPF among unrelated TXT records" (no false positive), "duplicate SPF", and "duplicate DMARC" cases, andsummarizeRequiredDnsChecks/partitionDnsRecords/the Stalwart and demo providers all key offok, so a conflict correctly keeps a domain out of theready/okstate without any special-casing gaps. The UI change indns-records.tsxrenders the new "Multiple records" status and copy consistently with the existing mismatch-rendering pattern.Non-blocking: the new DNSSEC check changes
stalwart-update's exit-code semantics. Left an inline comment ondeploy/stalwart/redakt-stalwart-deploy: the new "recent bogus DNSSEC events" gate inreport_statusis invoked both by the standalonestalwart-checkprobe and automatically at the end of a successfulstalwart-update, after the rollback traps are already cleared. That means a transient/stale DANE log line in the 15-minute window can make an already-completed, healthy image swap exit non-zero, which.trylle/workflows/stalwart.yml(running underset -euo pipefail) will surface as a failed deploy — with no rollback and no way to distinguish "the update failed" from "the update succeeded but delivery is currently unhealthy." Worth deciding whether that conflation is intentional; if not, keep the DNSSEC gate scoped tostalwart-checkor downgrade it to a warning after a successful update.No security, auth, or data-handling issues found in this diff, and no missing tests for the new SPF/DMARC branch logic.