SA Bugzilla – Bug 7723
[review] FromNameSpoof warnings with missing To-header
Last modified: 2020-11-01 18:02:14 UTC
Ugly warnings if message missing To: header (many legit mails in my corpus). warn: Use of uninitialized value $toaddrs[0] in lc at Mail/SpamAssassin/Plugin/FromNameSpoof.pm line 366. warn: Use of uninitialized value $owner in string ne at Mail/SpamAssassin/Plugin/FromNameSpoof.pm line 425. warn: Use of uninitialized value $2 in string ne at Mail/SpamAssassin/Plugin/FromNameSpoof.pm line 425. warn: Use of uninitialized value $owner in pattern match (m//) at Mail/SpamAssassin/Plugin/FromNameSpoof.pm line 429. Honestly the overall code flow / state machine could use quite a bit of polishing, there's repeated _check_fromnamespoof calls doing duplicate stuff from every eval function and the function itself seems to be returning randomly from different points. I'd rather leave sorting this out to Paul. ;-) For 3.4.3 perhaps just add below change and don't risk breaking other stuff, for RTC please vote to commit (I say +1) my @toaddrs = $pms->all_to_addrs(); + return 0 unless @toaddrs;
+1
+1 I'll look over other bits of logic and cleanup
+1 for me
Closing this as topic is fixed, but hopefully Paul can polish things up a bit after RTC in trunk :-) Sending spamassassin-3.4/lib/Mail/SpamAssassin/Plugin/FromNameSpoof.pm Sending trunk/lib/Mail/SpamAssassin/Plugin/FromNameSpoof.pm Transmitting file data ..done Committing transaction... Committed revision 1861634.
+1 though will we have the review and polish from Steamdragon soon? It's been awesome going through copious emails for bugzilla but I do want to roll rc3 and keep the momentum going.
FYI, multiple checks to _check_fromnamespoof are cached with a if defined check within the function, this doesn't cause evals to be fired multiple times.
sub _check_fromnamespoof { my ($self, $pms) = @_; return if (defined $pms->{fromname_contains_email}); my $conf = $pms->{conf}; $pms->{fromname_contains_email} = 0; Ah ok I read that too quickly, missed the "defined" bit.. But I don't think this will work reliably, since _check_fromnamespoof could be called much before the tag ever hits. $pms->action_depends_on_tags('DKIMDOMAIN', sub { my($pms,@args) = @_; $self->_check_fromnamespoof($pms);
Hmmm, I can't determine if I can actually make this consistent? Tag blocking runs all the way to the end of the run... Might just be best to drop the DKIM checking within FNS?
For trunk I previously added this hook which should help. $plugin->check_cleanup ( { options ... } ) Called just before message check is finishing and before possible auto-learning. This is guaranteed to be always called, unlike check_tick and check_post_dnsbl. Used for cleaning up left callbacks or forked children etc, last chance to make rules hit. You can simply postpone all checks and got_hit()s until that. If indeed there is any merit in checking DKIM stuff etc. But plenty of time to think before 4.0.0..
But probably this isn't even problem, since DKIM functions aren't async at the moment. As long as you define later priority for FNS rules than DKIM_SIGNED etc, DKIM results should be guaranteed to exist.
This aggressive exit skips *all* from-name spoofing checks (including the internal-to-From-header-only checks) if there is no To address. See bug 7869.