From f0dbc29da4fbbb0bf386d0a545ca3ffb7c0489a9 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Thu, 30 Oct 2025 10:03:46 +0700 Subject: [PATCH] Handle multiple dkim authentication-results --- pkg/analyzer/authentication_dkim.go | 9 ++- .../lib/components/AuthenticationCard.svelte | 56 ++++++++++--------- 2 files changed, 37 insertions(+), 28 deletions(-) diff --git a/pkg/analyzer/authentication_dkim.go b/pkg/analyzer/authentication_dkim.go index 9ce0dd2..9f1774b 100644 --- a/pkg/analyzer/authentication_dkim.go +++ b/pkg/analyzer/authentication_dkim.go @@ -97,13 +97,18 @@ func (a *AuthenticationAnalyzer) calculateDKIMScore(results *api.AuthenticationR // Expect at least one passing signature if results.Dkim != nil && len(*results.Dkim) > 0 { hasPass := false + hasNonPass := false for _, dkim := range *results.Dkim { if dkim.Result == api.AuthResultResultPass { hasPass = true - break + } else { + hasNonPass = true } } - if hasPass { + if hasPass && hasNonPass { + // Could be better + return 90 + } else if hasPass { return 100 } else { // Has DKIM signatures but none passed diff --git a/web/src/lib/components/AuthenticationCard.svelte b/web/src/lib/components/AuthenticationCard.svelte index 83e00ab..2db5cbe 100644 --- a/web/src/lib/components/AuthenticationCard.svelte +++ b/web/src/lib/components/AuthenticationCard.svelte @@ -147,31 +147,35 @@
-
- {#if authentication.dkim && authentication.dkim.length > 0} - -
- DKIM - - {authentication.dkim[0].result} - - {#if authentication.dkim[0].domain} -
- Domain: - {authentication.dkim[0].domain} -
- {/if} - {#if authentication.dkim[0].selector} -
- Selector: - {authentication.dkim[0].selector} -
- {/if} - {#if authentication.dkim[0].details} -
{authentication.dkim[0].details}
- {/if} + {#if authentication.dkim && authentication.dkim.length > 0} + {#each authentication.dkim as dkim, i} +
0}> + +
+ DKIM{authentication.dkim.length > 1 ? ` #${i + 1}` : ''} + + {dkim.result} + + {#if dkim.domain} +
+ Domain: + {dkim.domain} +
+ {/if} + {#if dkim.selector} +
+ Selector: + {dkim.selector} +
+ {/if} + {#if dkim.details} +
{dkim.details}
+ {/if} +
- {:else} + {/each} + {:else} +
DKIM @@ -180,8 +184,8 @@
DKIM signature is required for proper email authentication
- {/if} -
+
+ {/if}