Right now I am escaping all user input :
ERB::Util.html_escape_once("Netflix & Chill")
> "Netflix & Chill"
Now all my XSS attack worries are gone. However, my end users would not expect this string.
What is the best practice to both protect myself against XSS attacks yet display common use cases of the ampersand ( & ), as well any what we would expect in urls ( /, ?, &, = )
One hypothesis I've had is that sites like stackoverflow.com probably .unescape encoded characters after they've made their way to the View. But I'm not sure if this is accurate or a common practice.
&would just be an & in the browser. - Gabor Lengyel