SECURITY: Remove email validation check bypass

- Increase size of email column to varchar(513)
 - Give error message on signup when email is too large

Overall impact: Low, allows signups from blocked domains. Main risk is increased spam.
This commit is contained in:
Sam 2015-07-14 09:46:00 +10:00
parent bffaf5a117
commit f8ba5346c4
3 changed files with 15 additions and 0 deletions

View File

@ -230,6 +230,10 @@ class UsersController < ApplicationController
return
end
if params[:email] && params[:email].length > 254 + 1 + 253
return fail_with("login.email_too_long")
end
user = User.new(user_params)
# Handle custom fields

View File

@ -1273,6 +1273,9 @@ en:
omniauth_error_unknown: "Something went wrong processing your log in, please try again."
new_registrations_disabled: "New account registrations are not allowed at this time."
password_too_long: "Passwords are limited to 200 characters."
email_too_long: "The email you provided is too long. Mailbox names must be no more than 254 characters, and domain names must be no more than 253 characters."
reserved_username: "That username is not allowed."
missing_user_field: "You have not completed all the user fields"
close_window: "Authentication is complete. Close this window to continue."

View File

@ -0,0 +1,8 @@
class EnlargeUsersEmailField < ActiveRecord::Migration
def up
change_column :users, :email, :string, :limit => 513
end
def down
change_column :users, :email, :string, :limit => 128
end
end