Commit d5d92810 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 472362: [SECURITY] Malicious attachments can change your user settings (user…

Bug 472362: [SECURITY] Malicious attachments can change your user settings (user + email prefs, shared searches) - Patch by Fré©ric Buclin <LpSolit@gmail.com> r=wicked a=LpSolit
parent 9c49307f
...@@ -85,6 +85,7 @@ ...@@ -85,6 +85,7 @@
[% IF current_tab.saveable %] [% IF current_tab.saveable %]
<form name="userprefsform" method="post" action="userprefs.cgi"> <form name="userprefsform" method="post" action="userprefs.cgi">
<input type="hidden" name="tab" value="[% current_tab.name %]"> <input type="hidden" name="tab" value="[% current_tab.name %]">
<input type="hidden" name="token" value="[% token FILTER html %]">
[% END %] [% END %]
[% PROCESS "account/prefs/${current_tab.name}.html.tmpl" [% PROCESS "account/prefs/${current_tab.name}.html.tmpl"
......
...@@ -517,6 +517,9 @@ trick_taint($current_tab_name); ...@@ -517,6 +517,9 @@ trick_taint($current_tab_name);
$vars->{'current_tab_name'} = $current_tab_name; $vars->{'current_tab_name'} = $current_tab_name;
my $token = $cgi->param('token');
check_token_data($token, 'edit_user_prefs') if $cgi->param('dosave');
# Do any saving, and then display the current tab. # Do any saving, and then display the current tab.
SWITCH: for ($current_tab_name) { SWITCH: for ($current_tab_name) {
/^account$/ && do { /^account$/ && do {
...@@ -547,6 +550,11 @@ SWITCH: for ($current_tab_name) { ...@@ -547,6 +550,11 @@ SWITCH: for ($current_tab_name) {
{ current_tab_name => $current_tab_name }); { current_tab_name => $current_tab_name });
} }
delete_token($token) if $cgi->param('dosave');
if ($current_tab_name ne 'permissions') {
$vars->{'token'} = issue_session_token('edit_user_prefs');
}
# Generate and return the UI (HTML page) from the appropriate template. # Generate and return the UI (HTML page) from the appropriate template.
print $cgi->header(); print $cgi->header();
$template->process("account/prefs/prefs.html.tmpl", $vars) $template->process("account/prefs/prefs.html.tmpl", $vars)
......
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