haml / haml-rails

let your Gemfile do the talking
MIT License
1.04k stars 169 forks source link

content_for fails to sanitize input when using HAML #174

Open notalex opened 4 years ago

notalex commented 4 years ago

See the following pages:

https://content-for-rails.herokuapp.com/works https://content-for-rails.herokuapp.com/fails

%p HAML: content_for marks input as html_safe but does not sanitize it.
- content_for(:page_title) { "</title><script>alert('Pawned')</script>;" }
- puts content_for(:page_title) #=> prints unsanitized text marked as html_safe.
%p= content_for(:page_title)