Comments (1)
Thanks!
You are correct in that <script>alert()</script>@domain.com
is very much not a valid email address. While <script>alert()</script>@domain.com
is invalid, properly escaping user input when rendered as HTML would not allow that invalid email address to be executed as JavaScript. So, the only real consideration is that a clearly invalid email address is passing the simple validation check.
The "local-part" (username) characters in an email address should be limited to only /[a-z][-a-z0-9!#$%&'*+"=?^_`{}|~]{0,63}/
, per RFC 2822. Your suggested alternative is not RFC compliant either; in fact the author calls it "madness". There was, at one point, a "strict mode" for this gem which had increased validation covering some of that. However, it is worth noting that the clearly stated validation philisophy of this gem (as of 2019-03-02) is to use an extremely loose interpretation of what constitutes an email address.
Yes, I have read The 100% correct way to validate email addresses and just simply disagree with the general "epiphany". While "send your users an activation email" is indisputably the best way to validate a users email address, what happens to other email address that aren't provided as part of user registration; one to which a confirmation/validation email should not be sent? What about parsing emails from another source than typed user input? A field validator has more reason for existence than to check for a user's typos.
FWIW, I use my fork of this repo (at a much earlier version) which implements a much more strict interpretation of a "valid" email address (e.g: karl
is a strictly valid email address, per the RFCs). You are certainly welcome to use my fork, but I would very much like to see this official repo have proper email validation and agree that /[^\s]@[^\s]/
is entirely insufficient. I realize that my concerns are outside the defined scope of this gem, which is why I maintain my fork. I just wish that it weren't so.
from email_validator.
Related Issues (20)
- Is there any way to validate custom domain email? HOT 3
- Security Warning HOT 3
- Validation not catching jdoe@example-com HOT 3
- Semicolon and emails with not tld in email addresses in version 2.0.1 HOT 2
- Rails 6 support HOT 5
- Error when putting code in model HOT 1
- Alternative gem: email_verifier
- It is allowing invalid emails HOT 13
- Badge points to other repo HOT 2
- 2020.example.com is a valid fqdn HOT 8
- Valid numeric domains are considered invalid in strict mode HOT 2
- TravisCI Builds are failing for ppc64le+ruby 2.4 HOT 3
- Add rspec matcher
- Alternative gem: validates_email_format_of
- More disposable domains
- ACE representation of email address with IDN considered invalid HOT 6
- [CodeClimate] Class EmailValidator has 25 methods (exceeds 20 allowed)
- [CodeClimate] Method valid? has a Cognitive Complexity of 6 (exceeds 5 allowed).
- .tech domains
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from email_validator.