Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email Regex #20

Merged
merged 2 commits into from
Jul 31, 2015
Merged

Email Regex #20

merged 2 commits into from
Jul 31, 2015

Conversation

pyrossh
Copy link

@pyrossh pyrossh commented Jul 31, 2015

Using

 /^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i

@kumarharsh
Copy link
Member

That OWASP is incredibly bad! That's surprising, given the reason they exist!

Have a look at Angular's email validation regex, which is itself ported from chromium's regex, which is what w3c recommends:

/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/

REF: angular/angular.js#5899

@kumarharsh
Copy link
Member

I think the current PR using the emailregex.com regex is better, as it doesn't allow invalid email addresses like:
..test@example.com

The w3c regex lets the one above pass, the person inputting that bad email is then responsible to actually "verify" his email, or something equivalent.

On a related note, this one is valid, but I don't think a web service would need this... a custom implementation might though:
test@example

In the end, we have to decide: what's the purpose of themis? To serve the web, or be more general purpose?

atrniv pushed a commit that referenced this pull request Jul 31, 2015
@atrniv atrniv merged commit 5f9c23d into playlyfe:master Jul 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants