Project

General

Profile

Actions

Defect #36969

closed

EmailAddress regex matches invalid email addresses

Added by salman mp about 2 years ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Accounts / authentication
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

There is a regex in the EmailAddress class, that matches some invalid email address like these:

test,email@example.com
,test@example.com
$test@example.com

class EmailAddress < ActiveRecord::Base
  include Redmine::SafeAttributes

  EMAIL_REGEXP = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+(?:(?:xn--[-a-z0-9]+)|(?:[a-z]{2,})))\z/i

May be better to use URI::MailTo::EMAIL_REGEXP instead.


Files

36969.patch (1.5 KB) 36969.patch Go MAEDA, 2022-04-18 10:42
36969-v2.patch (1.92 KB) 36969-v2.patch Go MAEDA, 2022-04-20 02:43

Related issues

Related to Redmine - Defect #37922: Valid email address is not allowedClosed

Actions
Related to Redmine - Defect #6088: eMail in uncommon formats considered invalidClosed2010-08-09

Actions
Actions

Also available in: Atom PDF