@@ -19,7 +19,7 @@ use Bugzilla::Error;
1919use Bugzilla::Status;
2020
2121use File::Basename;
22- use Digest::MD5 qw( md5_hex ) ;
22+ use Digest::SHA qw( hmac_sha256_base64 ) ;
2323
2424# If we're using bug groups for products, we should apply those restrictions
2525# to viewing reports, as well. Time to check the login in that case.
@@ -90,14 +90,12 @@ else {
9090 # Filenames must not be guessable as they can point to products
9191 # you are not allowed to see. Also, different projects can have
9292 # the same product names.
93- my $key = Bugzilla-> localconfig-> {' site_wide_secret' };
9493 my $project = bz_locations()-> {' project' } || ' ' ;
95- my $image_file = join (' :' , ($key , $project , $prod_id , @datasets ));
96- # Wide characters cause md5_hex() to die.
97- if (Bugzilla-> params-> {' utf8' }) {
98- utf8::encode($image_file ) if utf8::is_utf8($image_file );
99- }
100- $image_file = md5_hex($image_file ) . ' .png' ;
94+ my $image_file = join (' :' , ($project , $prod_id , @datasets ));
95+ my $key = Bugzilla-> localconfig-> {' site_wide_secret' };
96+ $image_file = hmac_sha256_base64($image_file , $key ) . ' .png' ;
97+ $image_file =~ s /\+ / -/ g ;
98+ $image_file =~ s /\/ / _/ g ;
10199 trick_taint($image_file );
102100
103101 if (! -e " $graph_dir /$image_file " ) {
0 commit comments