From the course: Ruby on Rails 6: Controllers and Views

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Sanitization helpers

Sanitization helpers - Ruby on Rails Tutorial

From the course: Ruby on Rails 6: Controllers and Views

Start my 1-month free trial

Sanitization helpers

- [Instructor] In this movie, we're going to learn about sanitization helpers. We'll learn what they are and why you need them. When we talk about sanitizing content, our primary concern is to prevent something called cross site scripting or XSS for short. In cross site scripting, a hacker submits a string, which is constructed to make our browser do something we don't intend. It lets a hacker use JavaScript to script our site, that's why it's called cross site scripting. There are a lot of things that a hacker could do such as redirecting users to another web page or stealing cookies or log in information. Here's a simple example. I've just defined an evil_string that's going to pop up an alert that says "Gotcha!" It's just a placeholder for any malicious JavaScript. If at any point we output that string to one of our templates, then it could put that JavaScript into the template and the browser receiving the page…

Contents