Page MenuHomePhabricator

Add rough validation on email addresses
ClosedPublic

Authored by epriestley on Feb 24 2014, 12:17 AM.
Tags
None
Referenced Files
F14064651: D8320.diff
Tue, Nov 19, 12:39 AM
F14051649: D8320.diff
Fri, Nov 15, 2:48 AM
F14040868: D8320.diff
Mon, Nov 11, 1:50 PM
F14023209: D8320.diff
Thu, Nov 7, 12:04 AM
F13991922: D8320.diff
Tue, Oct 22, 1:21 PM
F13976097: D8320.id19786.diff
Oct 18 2024, 12:51 PM
F13967919: D8320.id19776.diff
Oct 16 2024, 5:05 PM
F13967697: D8320.id19785.diff
Oct 16 2024, 3:20 PM
Subscribers

Details

Reviewers
arice
btrahan
Commits
Restricted Diffusion Commit
rPf49470f9bf91: Add rough validation on email addresses
Summary

Put a very rough filter on what we'll accept as an email address. We can expand this if anyone is actually using local delivery or other weird things. This is mostly to avoid a theoretical case where some input is parsed differently by PhutilAddressParser and the actual mail adapter, in some subtle hypothetical way. This should give us only "reasonable" email addresses which parsers would be hard-pressed to trip up on.

Test Plan

Added and executed unit tests. Tried to add silly emails. Added valid emails.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

A masterpiece.

src/applications/people/storage/PhabricatorUserEmail.php
52

In the local portion, there are a number of special characters that are technically permissible, but relatively uncommon. It probably wouldn't hurt to whitelist the whole range, but the only missing character in common usage is !

"atext", here: http://tools.ietf.org/html/rfc5322#section-3.2.3

src/applications/people/storage/__tests__/PhabricatorUserEmailTestCase.php
23

Would add failure cases for the common delimiters (, ;) as well as repeat @

  • user;user@gmail.com
  • user,user@gmail.com
  • user@example.com@gmail.com
epriestley updated this revision to Unknown Object (????).Feb 24 2014, 1:31 AM
  • Allow ! in the local portion.
  • Add tests covering ,, ;, and multiple @.
epriestley updated this revision to Unknown Object (????).Feb 24 2014, 1:31 AM
  • A couple more fluff tests.