Skip to content

Instantly share code, notes, and snippets.

View Vanderln's full-sized avatar

Bill Van Der Laan Vanderln

View GitHub Profile

Web Security (should know for job interviews)

This post outlines three common web security vulnerabilities with specific examples in Rails. For a more complete list, I highly recommend the OWASP Rails security cheatsheet.

Cross-Site Scripting (XSS)

A cross-site scripting attack is when malicious scripts are injected into a web site in order to compromise it.

For example, let's say we want to allow html tags such as <strong> in our blog comments, so we render raw output using the Rails method #html_safe: