Compare commits

...

2 commits

Author SHA1 Message Date
9c3109c087 rbl: apply flat 10% penalty for informational list hits
Some checks are pending
continuous-integration/drone/push Build is running
Informational lists previously didn't count toward the score at all.
Now any informational listing applies a flat 10% penalty regardless of
how many of them fire, with the final score clamped at 0.
2026-06-13 17:56:31 +09:00
eb52a1d135 spamassassin: disable EMPTY_MESSAGE penalty for test compatibility 2026-06-13 17:46:10 +09:00
2 changed files with 14 additions and 3 deletions

View file

@ -58,4 +58,7 @@ score RCVD_IN_VALIDITY_RPBL_BLOCKED 0
score RCVD_IN_VALIDITY_SAFE_BLOCKED 0
score RCVD_IN_VALIDITY_CERTIFIED 0
score RCVD_IN_VALIDITY_RPBL 0
score RCVD_IN_VALIDITY_SAFE 0
score RCVD_IN_VALIDITY_SAFE 0
# emails with no text are common for tests, don't penalize them
score EMPTY_MESSAGE 0

View file

@ -302,7 +302,9 @@ func (r *DNSListChecker) reverseIP(ipStr string) string {
}
// CalculateScore calculates the list contribution to deliverability.
// Informational lists are not counted in the score.
// Informational lists don't count proportionally; instead, if any
// informational list triggers, a flat 10% penalty is applied regardless
// of how many of them fire.
func (r *DNSListChecker) CalculateScore(results *DNSListResults, forWhitelist bool) (int, string) {
scoringListCount := len(r.Lists) - len(r.informationalSet)
@ -324,7 +326,13 @@ func (r *DNSListChecker) CalculateScore(results *DNSListResults, forWhitelist bo
return 100, "A+"
}
percentage := 100 - results.RelevantListedCount*100/scoringListCount
// A listing on any informational list applies a flat 10% penalty.
informationalPenalty := 0
if results.ListedCount > results.RelevantListedCount {
informationalPenalty = 10
}
percentage := max(0, 100-results.RelevantListedCount*100/scoringListCount-informationalPenalty)
return percentage, ScoreToGrade(percentage)
}