Skip to content

Commit

Permalink
[#7] Fixes a potential mass-assignment vulnerability as pointed by br…
Browse files Browse the repository at this point in the history
…akeman.
  • Loading branch information
fabionl committed Nov 28, 2021
1 parent b5967f5 commit 7b3ca64
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def load_user
end

def user_params
params.require(:user).permit(:name, :email, :phone_number, :organization, :verified, :admin, :password, :password_confirmation)
parameters = params.require(:user).permit(:name, :email, :phone_number, :organization, :verified, :password, :password_confirmation)
parameters[:admin] = params.dig(:user, :admin) if current_user_admin?

parameters
end
end

0 comments on commit 7b3ca64

Please sign in to comment.