Skip Menu |

This queue is for tickets about the Mail-SPF CPAN distribution.

Report information
The Basics
Id: 88390
Status: patched
Priority: 0/
Queue: Mail-SPF

Owner: JMEHNLE [...]
Requestors: jhall [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: Improper handling of SPF records with embedded newlines
Date: Tue, 03 Sep 2013 11:44:23 -0500
To: bug-Mail-SPF [...]
From: Jonathan Hall <jhall [...]>
Download (untitled) / with headers
text/plain 1.4k
Occasionally one will encounter an SPF record with an embedded newline. Experience shows this is most common in include records. Examples (with " marks around the text portion, to make newlines more apparent). 3600 IN TXT "v=spf1 a mx ~all" 86400 IN TXT "v=spf1 a mx ~all" And: 100 IN TXT "v=spf1 ?all" 100 IN TXT "v=spf1 exists:_h.%{h}._l.%{l}._o.%{o}._i.%{i} ?all " When this happens, Mail::SPF generates an invalid Received header, such as: Received-SPF: permerror ( ... Junk encountered in record 'v=spf1 exists:_h.%{h}._l.%{l}._o.%{o}._i.%{i} ?all '); identity=mailfrom; envelope-from="";; client-ip= This header causes Mail::Header to complain, as there is no space after the newline. Possible solutions: - Strip the newline(s) in the DNS resolver. - Strip the newline(s) in the output headers - Add a space after the newline in the headers (This would make the header 'valid' again, but seems sloppy, as the newlines are rather arbitrary) - Raise an error?
Download (untitled) / with headers
text/plain 474b
CR or LF characters are illegal in SPF records per and . This is why Mail::SPF responds with a permerror. The fact that Mail::SPF::Result generates a Received-SPF header field containing CR or LF from the original record is a bug. The solution is for Mail::SPF::Result to sanitize the explanation string (which contains the original record). Will be fixed in the next release.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to