MM-60780: Reject emails within angle brackets (#29661)

* Reject emails within angle brackets

mail.ParseAddress is RFC-compliant, which means that it accepts emails
with names, as in "Billy Bob <billy@example.com>". It even accepts this
form *without* a name; e.g. "<billy@example.com>". We want to store the
plain address, so we compare the user input with the Address field of
the result from mail.ParseAddress, which should contain only
"billy@example.com", thus only accepting emails that do not contain
names nor angle brackets.

* Log a warning for admins with clear next steps

* Fix wording of comment

* And a typo

* Add specific command example to log message

* Add input email to log message

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Alejandro García Montoro
2025-04-21 19:22:15 +02:00
коммит произвёл GitHub
родитель 502506a517
Коммит de46d798e4
2 изменённых файлов: 20 добавлений и 6 удалений

Просмотреть файл

@@ -372,6 +372,10 @@ func TestIsValidEmail(t *testing.T) {
Input: "Billy Bob <billy@example.com>",
Expected: false,
},
{
Input: "<billy@example.com>",
Expected: false,
},
{
Input: "email.domain.com",
Expected: false,