From 5a2a6eaa78fc6173d9be6adf42008ed6bbb9ab17 Mon Sep 17 00:00:00 2001
From: John Coffey
Date: Fri, 13 Nov 2026 23:53:18 -0700
Subject: [PATCH] DMARC reports: show passes where SPF or DKIM failed
A message passes DMARC when either aligned check passes, so forwarded
mail (SPF fails, DKIM survives) counts as passed, which is right. But
the failing half is still worth seeing: it's how forwarding shows up,
and it can point at a sender missing from SPF or a DKIM key failing on
one route.
Who sends as your domains now says how many of a domain's passing
messages had SPF or DKIM failing, explains what that usually means,
and each passing sender says "SPF failed on N" or "DKIM failed on N".
They stay passes: the domain's failure count and the dashboard are
unchanged, so the two keep agreeing on what a failure is. It works from
the stored reports, so reports received before the upgrade show it too.
Fixes inbuxa/inbuxa-server#395
---
.../incomingReports/DmarcSummaryCard.tsx | 29 +++++++++++++++++
.../incomingReports/summarize.test.ts | 32 +++++++++++++++++++
src/features/incomingReports/summarize.ts | 15 +++++++++
src/i18n/en.json | 7 +++-
4 files changed, 82 insertions(+), 1 deletion(-)
diff --git a/src/features/incomingReports/DmarcSummaryCard.tsx b/src/features/incomingReports/DmarcSummaryCard.tsx
index f15b606..1df96fb 100644
--- a/src/features/incomingReports/DmarcSummaryCard.tsx
+++ b/src/features/incomingReports/DmarcSummaryCard.tsx
@@ -66,6 +66,18 @@ function SourceRow({ source }: { source: Source }) {
{source.provedBy === 'spf'
? t('inReports.passedSpf', 'Passed (SPF)')
: t('inReports.passedDkim', 'Passed (DKIM)')}
+ {(source.partial.spf > 0 || source.partial.dkim > 0) && (
+
+ {[
+ source.partial.spf > 0 &&
+ t('inReports.partialSpf', 'SPF failed on {{count}}', { count: source.partial.spf }),
+ source.partial.dkim > 0 &&
+ t('inReports.partialDkim', 'DKIM failed on {{count}}', { count: source.partial.dkim }),
+ ]
+ .filter(Boolean)
+ .join(', ')}
+
+ )}
) : (
@@ -116,6 +128,15 @@ function DomainBlock({ summary }: { summary: DomainSummary }) {
messages: num(summary.messages),
})}
+ {summary.partial > 0 && (
+
+ {t('inReports.partialCount', {
+ count: summary.partial,
+ defaultValue_one: '{{count}} of them with SPF or DKIM failing',
+ defaultValue_other: '{{count}} of them with SPF or DKIM failing',
+ })}
+
+ )}
{summary.failed > 0 && (
@@ -162,6 +183,14 @@ function DomainBlock({ summary }: { summary: DomainSummary }) {
)}
+ {summary.partial > 0 && (
+
+ {t(
+ 'inReports.partialHint',
+ 'These still passed DMARC, because one passing check is enough. SPF failing is usual for forwarded mail, which keeps its DKIM signature. A sender of yours that always fails SPF may be missing from your SPF record, and DKIM failing on one route can mean a key that doesn’t match or a service that changes messages.',
+ )}
+
+ )}
diff --git a/src/features/incomingReports/summarize.test.ts b/src/features/incomingReports/summarize.test.ts
index 4641aba..4193d01 100644
--- a/src/features/incomingReports/summarize.test.ts
+++ b/src/features/incomingReports/summarize.test.ts
@@ -97,6 +97,38 @@ describe('summarizeDmarc', () => {
expect(d.sources[0].provedBy).toBeNull();
});
+ it('counts passes with SPF or DKIM failing apart from failures (#395)', () => {
+ const [d] = summarizeDmarc([
+ dmarc([
+ // Forwarded: SPF fails, DKIM survives.
+ record({ count: 6, evaluatedSpf: 'fail', spfResults: [{ domain: 'forwarder.example', result: 'fail' }] }),
+ record({ count: 4 }),
+ // A service passing on SPF whose DKIM fails.
+ record({
+ sourceIp: '198.51.100.7',
+ count: 3,
+ evaluatedDkim: 'fail',
+ dkimResults: [{ domain: 'example.org', result: 'fail' }],
+ spfResults: [{ domain: 'bounces.mailer.example', result: 'pass' }],
+ }),
+ // A real failure is not a partial pass.
+ record({
+ sourceIp: '203.0.113.5',
+ count: 2,
+ evaluatedDkim: 'fail',
+ evaluatedSpf: 'fail',
+ dkimResults: [],
+ spfResults: [],
+ }),
+ ]),
+ ]);
+ expect(d).toMatchObject({ messages: 15, passed: 13, partial: 9, failed: 2 });
+ const by = Object.fromEntries(d.sources.map((s) => [s.label, s.partial]));
+ expect(by['example.org']).toEqual({ spf: 6, dkim: 0 });
+ expect(by['bounces.mailer.example']).toEqual({ spf: 0, dkim: 3 });
+ expect(by['203.0.113.5']).toEqual({ spf: 0, dkim: 0 });
+ });
+
it('takes the policy from the newest report', () => {
const [d] = summarizeDmarc([
dmarc([record()], { policyDisposition: 'reject', dateRangeEnd: '2026-10-05T00:00:00Z' }, 'new'),
diff --git a/src/features/incomingReports/summarize.ts b/src/features/incomingReports/summarize.ts
index 270474c..fe08d90 100644
--- a/src/features/incomingReports/summarize.ts
+++ b/src/features/incomingReports/summarize.ts
@@ -23,6 +23,12 @@ export interface Source {
messages: number;
/** Messages that passed DMARC (an aligned DKIM or SPF pass). */
passed: number;
+ /**
+ * inbuxa #395: of those that passed, how many had the other check fail,
+ * by which one failed. Forwarding fails SPF and keeps DKIM; a sender
+ * missing from SPF, or a DKIM key failing on one path, shows here too.
+ */
+ partial: Record<'spf' | 'dkim', number>;
/** What receivers did with the messages that failed. */
failedHandling: Record<'delivered' | 'quarantined' | 'rejected', number>;
reporters: string[];
@@ -32,6 +38,8 @@ export interface DomainSummary {
domain: string;
messages: number;
passed: number;
+ /** inbuxa #395: messages that passed DMARC with SPF or DKIM failing. Not failures. */
+ partial: number;
failed: number;
/** The policy the newest report saw published. */
policy: 'none' | 'quarantine' | 'reject' | 'unknown';
@@ -77,6 +85,7 @@ export function summarizeDmarc(reports: DmarcExternalReport[]): DomainSummary[]
domain: name,
messages: 0,
passed: 0,
+ partial: 0,
failed: 0,
policy: 'unknown',
testing: false,
@@ -110,6 +119,7 @@ export function summarizeDmarc(reports: DmarcExternalReport[]): DomainSummary[]
ips: [],
messages: 0,
passed: 0,
+ partial: { spf: 0, dkim: 0 },
failedHandling: { delivered: 0, quarantined: 0, rejected: 0 },
reporters: [],
};
@@ -120,6 +130,11 @@ export function summarizeDmarc(reports: DmarcExternalReport[]): DomainSummary[]
if (ok) {
s.passed += count;
d.passed += count;
+ const spfFailed = r.evaluatedSpf !== 'pass';
+ const dkimFailed = r.evaluatedDkim !== 'pass';
+ if (spfFailed) s.partial.spf += count;
+ if (dkimFailed) s.partial.dkim += count;
+ if (spfFailed || dkimFailed) d.partial += count;
} else {
s.failedHandling[handling(r.evaluatedDisposition)] += count;
d.failed += count;
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 4f3fbd6..70cd10b 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -2139,7 +2139,12 @@
"range_other": "From {{count}} reports covering {{from}} to {{until}}.",
"title": "Who sends as your domains",
"hint": "Other mail servers report every message they got with your domain in From, and whether it proved it was really you.",
- "empty": "No reports yet. Large providers send one a day for each domain whose DMARC record asks for them (rua=)."
+ "empty": "No reports yet. Large providers send one a day for each domain whose DMARC record asks for them (rua=).",
+ "partialSpf": "SPF failed on {{count}}",
+ "partialDkim": "DKIM failed on {{count}}",
+ "partialCount_one": "{{count}} of them with SPF or DKIM failing",
+ "partialCount_other": "{{count}} of them with SPF or DKIM failing",
+ "partialHint": "These still passed DMARC, because one passing check is enough. SPF failing is usual for forwarded mail, which keeps its DKIM signature. A sender of yours that always fails SPF may be missing from your SPF record, and DKIM failing on one route can mean a key that doesn’t match or a service that changes messages."
},
"inTls": {
"startTlsNotSupported": "Your server didn’t offer encryption (STARTTLS).",
--
2.54.0