MM-60722 - don't allow multiple '@' in email (#28481)
* don't allow quoted strings in email * don't allow multiple '@' in email --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b8e462e198
Коммит
d5ce06e580
@@ -396,6 +396,50 @@ func TestIsValidEmail(t *testing.T) {
|
||||
Input: "email1@domain.com, email2@domain.com",
|
||||
Expected: false,
|
||||
},
|
||||
{
|
||||
Input: "\"attacker@attacker.com,admin\"@spaceship.com",
|
||||
Expected: false,
|
||||
},
|
||||
{
|
||||
Input: "(email)@domain.com",
|
||||
Expected: false,
|
||||
},
|
||||
{
|
||||
Input: "<email>@domain.com",
|
||||
Expected: false,
|
||||
},
|
||||
{
|
||||
Input: "[email]@domain.com",
|
||||
Expected: false,
|
||||
},
|
||||
{
|
||||
Input: "{email}@domain.com",
|
||||
Expected: true,
|
||||
},
|
||||
{
|
||||
Input: "first\"name@domain.com",
|
||||
Expected: false,
|
||||
},
|
||||
{
|
||||
Input: "first:name@domain.com",
|
||||
Expected: false,
|
||||
},
|
||||
{
|
||||
Input: "first;name@domain.com",
|
||||
Expected: false,
|
||||
},
|
||||
{
|
||||
Input: "first,name@domain.com",
|
||||
Expected: false,
|
||||
},
|
||||
{
|
||||
Input: "first@name@domain.com",
|
||||
Expected: false,
|
||||
},
|
||||
{
|
||||
Input: "john..doe@example.com",
|
||||
Expected: false,
|
||||
},
|
||||
} {
|
||||
t.Run(testCase.Input, func(t *testing.T) {
|
||||
assert.Equal(t, testCase.Expected, IsValidEmail(testCase.Input))
|
||||
|
||||
Ссылка в новой задаче
Block a user