Page MenuHomePhabricator

Add rough validation on email addresses
ClosedPublic

Authored by epriestley on Feb 24 2014, 12:17 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 22, 1:18 AM
Unknown Object (File)
Fri, Dec 20, 3:54 PM
Unknown Object (File)
Fri, Dec 20, 3:48 PM
Unknown Object (File)
Tue, Dec 10, 7:06 AM
Unknown Object (File)
Sat, Dec 7, 6:44 AM
Unknown Object (File)
Thu, Dec 5, 5:11 AM
Unknown Object (File)
Wed, Nov 27, 7:43 AM
Unknown Object (File)
Tue, Nov 26, 11:59 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.