Fix email with empty domain name labels passing validation (#23246)
* Fix email with empty domain name labels passing validation `EmailMxValidator` would allow empty labels because `Resolv::DNS` is particularly lenient about them, but the email would be invalid and unusable. * Add tests
This commit is contained in:
		@@ -10,6 +10,8 @@ class EmailMxValidator < ActiveModel::Validator
 | 
			
		||||
 | 
			
		||||
    if domain.blank?
 | 
			
		||||
      user.errors.add(:email, :invalid)
 | 
			
		||||
    elsif domain.include?('..')
 | 
			
		||||
      user.errors.add(:email, :invalid)
 | 
			
		||||
    elsif !on_allowlist?(domain)
 | 
			
		||||
      resolved_ips, resolved_domains = resolve_mx(domain)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user