Handle RFC6652
All checks were successful
continuous-integration/drone/push Build is passing

Closes: https://framagit.org/happyDomain/happydeliver/-/issues/1
This commit is contained in:
nemunaire 2025-11-07 14:09:05 +07:00
commit deb9fd4f51
2 changed files with 31 additions and 2 deletions

View file

@ -191,8 +191,12 @@ func (d *DNSAnalyzer) isValidSPFMechanism(token string) error {
// Check if it's a modifier (contains =)
if strings.Contains(mechanism, "=") {
// Only allow known modifiers: redirect= and exp=
if strings.HasPrefix(mechanism, "redirect=") || strings.HasPrefix(mechanism, "exp=") {
// Allow known modifiers: redirect=, exp=, and RFC 6652 modifiers (ra=, rp=, rr=)
if strings.HasPrefix(mechanism, "redirect=") ||
strings.HasPrefix(mechanism, "exp=") ||
strings.HasPrefix(mechanism, "ra=") ||
strings.HasPrefix(mechanism, "rp=") ||
strings.HasPrefix(mechanism, "rr=") {
return nil
}