[DEV-6756] Prevent special chars from "local-part" of email address
The `"(),:;<>@[\]`` are allowed in the "local-part" of an email address under certain circumstances, but our regex is not checking those circumstances. It is better if we do not allow them until we improve validation.master
parent
b48a9f0de2
commit
aa2ba885af
|
@ -22,7 +22,7 @@
|
||||||
// characters allowed in local-part, omitting dot (some of these are only
|
// characters allowed in local-part, omitting dot (some of these are only
|
||||||
// allowed within quotes, but we're not going to bother convuluting the regex
|
// allowed within quotes, but we're not going to bother convuluting the regex
|
||||||
// with that)
|
// with that)
|
||||||
var local_chars = '[a-zA-Z0-9!#$%&\'*+/=?^_1{|}~()\\\\" (),:;<>@\\[\\]-]';
|
var local_chars = '[a-zA-Z0-9!#$%&\'*+/=?^_1{|}~-]';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,7 +34,6 @@ describe( 'validate.formatter.StringFormat', function()
|
||||||
"firstname.lastname@domain.com",
|
"firstname.lastname@domain.com",
|
||||||
"email@subdomain.domain.com",
|
"email@subdomain.domain.com",
|
||||||
"firstname+lastname@domain.com",
|
"firstname+lastname@domain.com",
|
||||||
'email"@domain.com',
|
|
||||||
"1234567890@domain.com",
|
"1234567890@domain.com",
|
||||||
"email@domain-one.com",
|
"email@domain-one.com",
|
||||||
"_______@domain.com",
|
"_______@domain.com",
|
||||||
|
@ -50,7 +49,7 @@ describe( 'validate.formatter.StringFormat', function()
|
||||||
"@domain.com",
|
"@domain.com",
|
||||||
"Joe Smith <email@domain.com>",
|
"Joe Smith <email@domain.com>",
|
||||||
"email.domain.com",
|
"email.domain.com",
|
||||||
// "email@domain@domain.com",
|
"email@domain@domain.com",
|
||||||
".email@domain.com",
|
".email@domain.com",
|
||||||
"email.@domain.com",
|
"email.@domain.com",
|
||||||
"email..email@domain.com",
|
"email..email@domain.com",
|
||||||
|
@ -59,5 +58,17 @@ describe( 'validate.formatter.StringFormat', function()
|
||||||
"email@domain",
|
"email@domain",
|
||||||
"email@-domain.com",
|
"email@-domain.com",
|
||||||
"email@domain..com",
|
"email@domain..com",
|
||||||
|
"em,ail@domain.com",
|
||||||
|
'em"ail@domain.com',
|
||||||
|
"em(ail@domain.com",
|
||||||
|
"em)ail@domain.com",
|
||||||
|
"em:ail@domain.com",
|
||||||
|
"em;ail@domain.com",
|
||||||
|
"em<ail@domain.com",
|
||||||
|
"em>ail@domain.com",
|
||||||
|
"em[ail@domain.com",
|
||||||
|
"em]ail@domain.com",
|
||||||
|
"em ail@domain.com",
|
||||||
|
"em\\ail@domain.com",
|
||||||
].forEach( email_address => assert.throws( () => Sut.parse( email_address ), Error ) );
|
].forEach( email_address => assert.throws( () => Sut.parse( email_address ), Error ) );
|
||||||
} );
|
} );
|
||||||
|
|
Loading…
Reference in New Issue