From 679854b8bbc65d112071111bbd7f34a6a481fb30 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 4 Jun 2013 00:21:24 -0700 Subject: RT 4.0.13 --- rt/lib/RT/Dashboard/Mailer.pm | 45 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) (limited to 'rt/lib/RT/Dashboard') diff --git a/rt/lib/RT/Dashboard/Mailer.pm b/rt/lib/RT/Dashboard/Mailer.pm index 40b53b111..9d28c4942 100644 --- a/rt/lib/RT/Dashboard/Mailer.pm +++ b/rt/lib/RT/Dashboard/Mailer.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -59,6 +59,7 @@ use RT::Dashboard; use RT::Interface::Web::Handler; use RT::Interface::Web; use File::Temp 'tempdir'; +use HTML::Scrubber; sub MailDashboards { my $self = shift; @@ -248,6 +249,8 @@ SUMMARY } } + $content = ScrubContent($content); + $RT::Logger->debug("Got ".length($content)." characters of output."); $content = HTML::RewriteAttributes::Links->rewrite( @@ -393,7 +396,7 @@ sub BuildEmail { Type => $mimetype, Encoding => $encoding, Disposition => 'inline', - Name => $filename, + Name => RT::Interface::Email::EncodeToMIME( String => $filename ), 'Content-Id' => $cid_of{$uri}, ); @@ -408,9 +411,9 @@ sub BuildEmail { ); my $entity = MIME::Entity->build( - From => $args{From}, - To => $args{To}, - Subject => $args{Subject}, + From => Encode::encode_utf8($args{From}), + To => Encode::encode_utf8($args{To}), + Subject => RT::Interface::Email::EncodeToMIME( String => $args{Subject} ), Type => "multipart/mixed", ); @@ -462,6 +465,33 @@ sub BuildEmail { } } +{ + my $scrubber; + + sub _scrubber { + unless ($scrubber) { + $scrubber = HTML::Scrubber->new; + # Allow everything by default, except JS attributes ... + $scrubber->default( + 1 => { + '*' => 1, + map { ("on$_" => 0) } + qw(blur change click dblclick error focus keydown keypress keyup load + mousedown mousemove mouseout mouseover mouseup reset select submit unload) + } + ); + # ... and