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)
Tue, Apr 16, 3:50 AM
Unknown Object (File)
Tue, Apr 16, 3:50 AM
Unknown Object (File)
Tue, Apr 16, 3:49 AM
Unknown Object (File)
Tue, Apr 16, 3:49 AM
Unknown Object (File)
Tue, Apr 16, 3:09 AM
Unknown Object (File)
Tue, Apr 16, 2:56 AM
Unknown Object (File)
Sat, Apr 13, 1:37 AM
Unknown Object (File)
Fri, Apr 12, 2:54 AM
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.