diff options
author | Claire <claire.github-309c@sitedethib.com> | 2023-01-24 20:18:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-24 20:18:41 +0100 |
commit | a5a00d7f7adff5e0afbd23ac1e1b16120137509a (patch) | |
tree | 257d56b90af020f8c8b7c9a0bd4d3f26e3b034bc /app | |
parent | dd58db64d87896698a840b6cffe06a0e816674ef (diff) |
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
Diffstat (limited to 'app')
-rw-r--r-- | app/validators/email_mx_validator.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/app/validators/email_mx_validator.rb b/app/validators/email_mx_validator.rb index 20f2fd37c..19c57bdf6 100644 --- a/app/validators/email_mx_validator.rb +++ b/app/validators/email_mx_validator.rb @@ -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) |