aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2014-09-09 14:58:27 +0100
committerGareth Rees <gareth@mysociety.org>2014-09-09 20:21:18 +0100
commitcf62c3e58595ef2fac2f7ec49304fd827ecbd854 (patch)
tree34f1b84eb1c9428b7d86770fa2c37964a1257225 /app/controllers
parent9f9f60106e8e65a5fd7ba5c979e87c03413518f1 (diff)
Whitelist UserController#signup params0.13.0.5hotfix/0.13.0.5
Protects from mass-assignment exploit attempts
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/user_controller.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 175425280..c2cc426d4 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -196,7 +196,7 @@ class UserController < ApplicationController
work_out_post_redirect
@request_from_foreign_country = country_from_ip != AlaveteliConfiguration::iso_country_code
# Make the user and try to save it
- @user_signup = User.new(params[:user_signup])
+ @user_signup = User.new(user_params(:user_signup))
error = false
if @request_from_foreign_country && !verify_recaptcha
flash.now[:error] = _("There was an error with the words you entered, please try again.")
@@ -598,6 +598,10 @@ class UserController < ApplicationController
private
+ def user_params(key = :user)
+ params[key].slice(:name, :email, :password, :password_confirmation)
+ end
+
def is_modal_dialog
(params[:modal].to_i != 0)
end