From 9e7f6444384c0990b89dda0ead7926b6307b960a Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Tue, 26 Jun 2018 16:49:07 -0400 Subject: Bug 1471304 - Block sending mail to hosts that end with .tld or .bugs --- Bugzilla/Mailer.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Bugzilla/Mailer.pm') diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm index 1b77e5063..c9a458b47 100644 --- a/Bugzilla/Mailer.pm +++ b/Bugzilla/Mailer.pm @@ -190,11 +190,16 @@ sub MessageToMTA { my @recipients = Email::Address->parse($to); die qq{Unable to parse "To:" address - $to\n} unless @recipients; die qq{Did not expect more than one "To:" address in $to\n} if @recipients > 1; - my $badhosts = Bugzilla::Bloomfilter->lookup("badhosts") or die "No badhosts bloomfilter\n"; - if ($badhosts->test($recipients[0]->host)) { + my $recipient = $recipients[0]; + my $badhosts = Bugzilla::Bloomfilter->lookup("badhosts"); + if ($badhosts && $badhosts->test($recipient->host)) { WARN("Attempted to send email to address in badhosts: $to"); $email->header_set(to => ''); } + elsif ($recipient->host =~ /\.(?:bugs|tld)$/) { + WARN("Attempted to send email to fake address: $to"); + $email->header_set(to => ''); + } } catch { ERROR($_); }; -- cgit v1.2.3-24-g4f1b