]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 472362: [SECURITY] Malicious attachments can change your user settings (user...
authorlpsolit%gmail.com <>
Mon, 2 Feb 2009 19:22:55 +0000 (19:22 +0000)
committerlpsolit%gmail.com <>
Mon, 2 Feb 2009 19:22:55 +0000 (19:22 +0000)
template/en/default/account/prefs/prefs.html.tmpl
userprefs.cgi

index ed9cbce72ed6b683b3131aae9a0eac6c3f895927..71e411d8640f80f27ee8bd7933f70410c741f953 100644 (file)
@@ -85,6 +85,7 @@
 [% IF current_tab.saveable %]
   <form name="userprefsform" method="post" action="userprefs.cgi">
     <input type="hidden" name="tab" value="[% current_tab.name %]">
+    <input type="hidden" name="token" value="[% token FILTER html %]">
 [% END %]
 
 [% PROCESS "account/prefs/${current_tab.name}.html.tmpl" 
index d73a61e5498456327a5c0b0c546d373a1c3983db..3b01e8f338e2b510780f006a6f114ccd86c4d2c5 100755 (executable)
@@ -527,6 +527,9 @@ trick_taint($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.
 SWITCH: for ($current_tab_name) {
     /^account$/ && do {
@@ -557,6 +560,11 @@ SWITCH: for ($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.
 print $cgi->header();
 $template->process("account/prefs/prefs.html.tmpl", $vars)