Commit fa954ab7 authored by Simon Green's avatar Simon Green Committed by David Lawrence

Bug 1064140: [SECURITY] Private comments can be shown to flagmail recipients who…

Bug 1064140: [SECURITY] Private comments can be shown to flagmail recipients who aren't in the insider group r=glob,a=glob
parent f33b119d
...@@ -1030,12 +1030,6 @@ sub update { ...@@ -1030,12 +1030,6 @@ sub update {
join(', ', @added_names)]; join(', ', @added_names)];
} }
# Flags
my ($removed, $added) = Bugzilla::Flag->update_flags($self, $old_bug, $delta_ts);
if ($removed || $added) {
$changes->{'flagtypes.name'} = [$removed, $added];
}
# Comments # Comments
foreach my $comment (@{$self->{added_comments} || []}) { foreach my $comment (@{$self->{added_comments} || []}) {
# Override the Comment's timestamp to be identical to the update # Override the Comment's timestamp to be identical to the update
...@@ -1058,6 +1052,9 @@ sub update { ...@@ -1058,6 +1052,9 @@ sub update {
$user->id, $delta_ts, $comment->id); $user->id, $delta_ts, $comment->id);
} }
# Clear the cache of comments
delete $self->{comments};
# Insert the values into the multiselect value tables # Insert the values into the multiselect value tables
my @multi_selects = grep {$_->type == FIELD_TYPE_MULTI_SELECT} my @multi_selects = grep {$_->type == FIELD_TYPE_MULTI_SELECT}
Bugzilla->active_custom_fields; Bugzilla->active_custom_fields;
...@@ -1090,6 +1087,12 @@ sub update { ...@@ -1090,6 +1087,12 @@ sub update {
join(', ', map { $_->name } @$added_see)]; join(', ', map { $_->name } @$added_see)];
} }
# Flags
my ($removed, $added) = Bugzilla::Flag->update_flags($self, $old_bug, $delta_ts);
if ($removed || $added) {
$changes->{'flagtypes.name'} = [$removed, $added];
}
$_->update foreach @{ $self->{_update_ref_bugs} || [] }; $_->update foreach @{ $self->{_update_ref_bugs} || [] };
delete $self->{_update_ref_bugs}; delete $self->{_update_ref_bugs};
......
...@@ -1124,18 +1124,32 @@ sub notify { ...@@ -1124,18 +1124,32 @@ sub notify {
$default_lang = Bugzilla::User->new()->setting('lang'); $default_lang = Bugzilla::User->new()->setting('lang');
} }
# Get comments on the bug
my $all_comments = $bug->comments({ after => $bug->lastdiffed });
@$all_comments = grep { $_->type || $_->body =~ /\S/ } @$all_comments;
# Get public only comments
my $public_comments = [ grep { !$_->is_private } @$all_comments ];
foreach my $to (keys %recipients) { foreach my $to (keys %recipients) {
# Add threadingmarker to allow flag notification emails to be the # Add threadingmarker to allow flag notification emails to be the
# threaded similar to normal bug change emails. # threaded similar to normal bug change emails.
my $thread_user_id = $recipients{$to} ? $recipients{$to}->id : 0; my $thread_user_id = $recipients{$to} ? $recipients{$to}->id : 0;
my $vars = { 'flag' => $flag, # We only want to show private comments to users in the is_insider group
'old_flag' => $old_flag, my $comments = $recipients{$to} && $recipients{$to}->is_insider
'to' => $to, ? $all_comments : $public_comments;
'date' => $timestamp,
'bug' => $bug, my $vars = {
'attachment' => $attachment, flag => $flag,
'threadingmarker' => build_thread_marker($bug->id, $thread_user_id) }; old_flag => $old_flag,
to => $to,
date => $timestamp,
bug => $bug,
attachment => $attachment,
threadingmarker => build_thread_marker($bug->id, $thread_user_id),
new_comments => $comments,
};
my $lang = $recipients{$to} ? my $lang = $recipients{$to} ?
$recipients{$to}->setting('lang') : $default_lang; $recipients{$to}->setting('lang') : $default_lang;
......
...@@ -68,11 +68,14 @@ Attachment [% attidsummary %] ...@@ -68,11 +68,14 @@ Attachment [% attidsummary %]
[%- FILTER bullet = wrap(80) %] [%- FILTER bullet = wrap(80) %]
[% USE Bugzilla %] [% FOREACH comment = new_comments %]
[%-# .defined is necessary to avoid a taint issue, see bug 509794. %]
[% IF Bugzilla.cgi.param("comment").defined && Bugzilla.cgi.param("comment").length > 0 %] [%- IF comment.count %]
------- Additional Comments from [% user.identity %] --- Comment #[% comment.count %] from [% comment.author.identity %] ---
[%+ Bugzilla.cgi.param("comment") FILTER strip_control_chars %] [% ELSE %]
--- Description ---
[% END %]
[%+ comment.body_full({ is_bugmail => 1, wrap => 1 }) FILTER strip_control_chars %]
[% END %] [% END %]
[%- END %] [%- END %]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment