Code Monkey home page Code Monkey logo

Comments (3)

balexand avatar balexand commented on September 13, 2024 1

The accepted way to prevent XSS attacks in Rails is to properly escape user inputted data when you are outputting them in your templates rather than validating the data when it is being input. Even with very strict email validation you will still be vulnerable to XSS attacks if you don't properly escape user inputted email addresses. Conversely, if you properly escape email addresses then you will be safe from XSS even if you perform no input validation at all.

You can learn more on the Rails Guides: https://guides.rubyonrails.org/security.html#cross-site-scripting-xss. Also, checkout out the mail_to helper if you are looking for an easy and secure way to generate mailto links.

from email_validator.

AGarrow avatar AGarrow commented on September 13, 2024

from the document:

7.3.2.3 Countermeasures
It is very important to filter malicious input, but it is also important to escape the output of the web application.

Especially for XSS, it is important to do whitelist input filtering instead of blacklist. Whitelist filtering states the values allowed as opposed to the values not allowed. Blacklists are never complete.

...

All I'm saying is you should give people a heads up that their only protection is escaping the output.

from email_validator.

AGarrow avatar AGarrow commented on September 13, 2024

I just think it might not occur to some that this validation philosophy gives them less protection than they might expect.

from email_validator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.