]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1620452 - secbugs report should be updated to allow emailing to multiple addresses
authordklawren <dklawren@users.noreply.github.com>
Fri, 6 Mar 2020 15:27:24 +0000 (10:27 -0500)
committerGitHub <noreply@github.com>
Fri, 6 Mar 2020 15:27:24 +0000 (10:27 -0500)
scripts/secbugsreport.pl

index 826dc0b024ee78908030f2fce88dbe9a314f49ab..54b6d79b8df540528e156cbd5d54b2343071f24b 100644 (file)
@@ -20,6 +20,7 @@ use Bugzilla;
 use Bugzilla::Component;
 use Bugzilla::Constants;
 use Bugzilla::Error;
+use Bugzilla::Logging;
 use Bugzilla::Mailer;
 use Bugzilla::Report::SecurityRisk;
 
@@ -35,8 +36,9 @@ Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
 
 my ($year, $month, $day, $hours, $minutes, $seconds, $time_zone_offset) = @ARGV;
 
-exit 0 unless Bugzilla->params->{report_secbugs_active};
-exit 0
+die 'secbugsreport.pl: report not active'
+  unless Bugzilla->params->{report_secbugs_active};
+die 'secbugsreport.pl: improper date format'
   unless Int->check($year)
   && Int->check($month)
   && Int->check($day)
@@ -157,10 +159,16 @@ my @parts_crit_high = (
   } sort { $a cmp $b } keys %{$report_crit_high->graphs}
 );
 
+my @recipients = split /[\s,]+/, Bugzilla->params->{report_secbugs_emails};
+DEBUG('recipients: ' . join ', ', @recipients);
+my $to_address   = shift @recipients;
+my $cc_addresses = @recipients ? join ', ', @recipients : '';
+
 my $email_crit_high = Email::MIME->create(
   header_str => [
     From              => Bugzilla->params->{'mailfrom'},
-    To                => Bugzilla->params->{report_secbugs_emails},
+    To                => $to_address,
+    Cc                => $cc_addresses,
     Subject           => "Security Bugs Report for $report_week",
     'X-Bugzilla-Type' => 'admin',
   ],
@@ -184,7 +192,8 @@ my @parts_moderate_low = (
 my $email_moderate_low = Email::MIME->create(
   header_str => [
     From              => Bugzilla->params->{'mailfrom'},
-    To                => Bugzilla->params->{report_secbugs_emails},
+    To                => $to_address,
+    Cc                => $cc_addresses,
     Subject           => "Security Bugs Report (moderate & low) for $report_week",
     'X-Bugzilla-Type' => 'admin',
   ],