Skip to content

Commit

Permalink
Fix to address XSS issues #1
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Aug 9, 2023
1 parent eeae146 commit c81a4c4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
7 changes: 6 additions & 1 deletion mailbox/list_folders.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,23 @@ print &ui_hidden_end("instr");
print &ui_form_start("delete_folders.cgi", "post");
my @tds = ( "width=5" );
my @folders = &list_folders_sorted();
foreach my $folder (@folders) {
$folder->{'file'} = &html_escape($folder->{'file'})
if ($folder->{'file'});
}
print &ui_columns_start([ "",
$text{'folders_name'},
$text{'folders_path'},
$text{'folders_type'},
$text{'folders_size'},
$text{'folders_action'} ], undef, 0, \@tds);
# var_dump(\@folders);
foreach my $f (@folders) {
my @cols;
my $deletable = 0;
if ($f->{'inbox'} || $f->{'drafts'} || $f->{'spam'}) {
# Inbox, drafs or spam folder which cannot be edited
push(@cols, $f->{'name'});
push(@cols, &html_escape($f->{'name'}));
}
elsif ($f->{'type'} == 2) {
# Link for editing POP3 folder
Expand Down
4 changes: 4 additions & 0 deletions mailbox/list_ifolders.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ require './mailbox-lib.pl';
print &ui_form_start("delete_folders.cgi", "post");
my @tds = ( "width=5" );
my @folders = &list_folders_sorted();
foreach my $folder (@folders) {
$folder->{'file'} = &html_escape($folder->{'file'})
if ($folder->{'file'});
}
my @adders = ( "<a href='edit_ifolder.cgi?new=1'>$text{'folders_addimap'}</a>",
"<a href='edit_comp.cgi?new=1'>$text{'folders_addcomp'}</a>",
"<a href='edit_virt.cgi?new=1'>$text{'folders_addvirt'}</a>" );
Expand Down
6 changes: 3 additions & 3 deletions mailbox/view_mail.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -521,15 +521,15 @@ if (!@sub) {
if ($mail->{'sortidx'} != 0) {
my $mailprv = $beside[$prv];
$left = "view_mail.cgi?id=".&urlize($mailprv->{'id'}).
"&folder=$in{'folder'}&start=$in{'start'}";
"&folder=@{[&urlize($in{'folder'})]}&start=$in{'start'}";
}
if ($mail->{'sortidx'} < $c-1) {
my $mailnxt = $beside[$nxt];
$right = "view_mail.cgi?id=".&urlize($mailnxt->{'id'}).
"&folder=$in{'folder'}&start=$in{'start'}";
"&folder=@{[&urlize($in{'folder'})]}&start=$in{'start'}";
}
print &ui_page_flipper(&text('view_desc', $mail->{'sortidx'}+1,
$folder->{'name'}),
&html_escape($folder->{'name'})),
undef, undef, $left, $right);
}
else {
Expand Down
2 changes: 1 addition & 1 deletion mailbox/webmin_menu.pl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ sub list_webmin_menu
my $item = { 'type' => 'item',
'id' => 'folder_'.$fid,
'folder' => 1,
'desc' => $f->{'name'},
'desc' => &html_escape($f->{'name'}),
'link' => '/'.$module_name.
'/index.cgi?id='.&urlize($fid) };
if ($f->{'type'} == 6 &&
Expand Down

0 comments on commit c81a4c4

Please sign in to comment.