aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2009-02-02 19:22:55 +0000
committerlpsolit%gmail.com <>2009-02-02 19:22:55 +0000
commit2ac801f9f20e6b277bb51e62ade703edce07a1db (patch)
tree96546b92b899d0dc6f5a4480db2cd69727c2aced
parentBug 472206: [SECURITY] Bugzilla should optionally not allow the user to view ... (diff)
downloadbugzilla-2ac801f9f20e6b277bb51e62ade703edce07a1db.tar.gz
bugzilla-2ac801f9f20e6b277bb51e62ade703edce07a1db.tar.bz2
bugzilla-2ac801f9f20e6b277bb51e62ade703edce07a1db.zip
Bug 472362: [SECURITY] Malicious attachments can change your user settings (user + email prefs, shared searches) - Patch by Frédéric Buclin <LpSolit@gmail.com> r=wicked a=LpSolit
-rw-r--r--template/en/default/account/prefs/prefs.html.tmpl1
-rwxr-xr-xuserprefs.cgi8
2 files changed, 9 insertions, 0 deletions
diff --git a/template/en/default/account/prefs/prefs.html.tmpl b/template/en/default/account/prefs/prefs.html.tmpl
index ed9cbce72..71e411d86 100644
--- a/template/en/default/account/prefs/prefs.html.tmpl
+++ b/template/en/default/account/prefs/prefs.html.tmpl
@@ -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"
diff --git a/userprefs.cgi b/userprefs.cgi
index d73a61e54..3b01e8f33 100755
--- a/userprefs.cgi
+++ b/userprefs.cgi
@@ -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)