Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One regression and miscellaneous documentation observations. #19

Open
GWHAYWOOD opened this issue Jul 23, 2024 · 6 comments
Open

One regression and miscellaneous documentation observations. #19

GWHAYWOOD opened this issue Jul 23, 2024 · 6 comments

Comments

@GWHAYWOOD
Copy link

The documentation for Mail::SPF version 3.20240617 still appears to claim version 2.009.

The documentation still talks about RFC4408. This (experimental) RFC was obsoleted by RFC7208 years ago.

Both in the documentation and IN MESSAGES RETURNED BY THE CODE the module still refers to the Website at openspf.org. This Website has been abandoned for many years. I recommend the Debian patches.

Stringification of the value reteurned from $request->record is broken for domains which have no SPF record.

@GWHAYWOOD
Copy link
Author

  1. A 'neutral-by-default' exception (Default neutral result due to no mechanism matches) is thrown for all records which contain a redirect. Is this intentional?

@bigio
Copy link
Contributor

bigio commented Aug 7, 2024

point n. 1 is addressed by pr #16, point 2 by pr #18

@bigio
Copy link
Contributor

bigio commented Aug 8, 2024

Stringification of the value reteurned from $request->record is broken for domains which have no SPF record.

It seems to work with the following code:

           use Mail::SPF;

           my $spf_server  = Mail::SPF::Server->new();

           my $request     = Mail::SPF::Request->new(
               versions        => [1, 2],              # optional
               scope           => 'mfrom',             # or 'helo', 'pra'
               identity        => '[email protected]',
               ip_address      => '1.2.3.4',
           );

           my $result      = $spf_server->process($request);
	   print $result->record->stringify;

Result is: "none (No applicable sender policy available)"

@GWHAYWOOD
Copy link
Author

The regression does not relate to ->stringify but to the use of the object as a string as per the documentation. Quoting perldoc mail::SPF::Record

stringify: returns *string*
    Returns the record's version tag and terms (including the global
    modifiers) formatted as a string. You can simply use a
    Mail::SPF::Record object as a string for the same effect, see
    "OVERLOADING".

Until this regression I was indeed using a Record object as a string and it did indeed stringify as documented in all cases of which I'm aware. It still does stringify if there is a TXT record for the domain but it doesn't now do that if there isn't; it gives me nasty error messages in my logs instead.

@bigio
Copy link
Contributor

bigio commented Aug 25, 2024

The regression does not relate to ->stringify but to the use of the object as a string as per the documentation. Quoting perldoc mail::SPF::Record

stringify: returns *string*
    Returns the record's version tag and terms (including the global
    modifiers) formatted as a string. You can simply use a
    Mail::SPF::Record object as a string for the same effect, see
    "OVERLOADING".

Until this regression I was indeed using a Record object as a string and it did indeed stringify as documented in all cases of which I'm aware. It still does stringify if there is a TXT record for the domain but it doesn't now do that if there isn't; it gives me nasty error messages in my logs instead.

do you have a sample code to trigger this issue ? Thanks.

@GWHAYWOOD
Copy link
Author

Sample code as requested:

$ cat ./test_spf_object_2.pl
#!/usr/bin/perl

use Net::DNS;
use Mail::SPF;
sub xm_DIE_handler { print "$_[0]\n"; }
$SIG{__DIE__} = \&xm_DIE_handler;
my $spf_server_object = Mail::SPF::Server->new();
my $spf_request_object = Mail::SPF::Request->new( versions => [1], scope => 'helo', identity => 'mail1.netways.de', ip_address => '2a01:4a0:4:1002:0:0:0:146' );
my $spf_result_object = $spf_server_object->process($spf_request_object);

print $spf_request_object->record, "\n";
$ ./test_spf_object_2.pl
No applicable sender policy available (ENoAcceptableRecord) at /usr/local/share/perl/5.32.1/Mail/SPF/Server.pm line 481.

HASH(0x1583b88)
$

There is no SPF TXT record for mail1.netways.de above.

If for example I query for a domain which does have an SPF TXT record:

$ ./test_spf_object_2.pl.~3~ 
neutral-by-default (Default neutral result due to no mechanism matches)
NetAddr::IP IPv4-mapped IPv6 address expected (EInvalidOptionValue) at /usr/local/share/perl/5.32.1/Mail/SPF/Util.pm line 128.

pass (Mechanism 'ptr:yahoo.com' matched)
pass (Mechanism 'ptr:yahoo.com' matched)
pass (Mechanism 'ptr:yahoo.com' matched)
pass (Mechanism 'ptr:yahoo.com' matched)
pass (Mechanism 'ptr:yahoo.com' matched)
v=spf1 redirect=_spf.mail.yahoo.com
$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants