Last active
August 29, 2015 14:15
-
-
Save wli/8072b88f4382e7f1757d to your computer and use it in GitHub Desktop.
How not to handle HTML escaping in Ruby on Rails.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Found this in our codebase the other day. Our contractor couldn't figure out how to | |
# escape html for ouput, so he overrode a Ruby-on-Rails builtin and disabled HTML-injection | |
# protection for the entire website. | |
class Object | |
def html_safe? | |
true | |
end | |
end | |
class String | |
def html_safe? | |
true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment