-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guidance for using html_safe #260
Comments
My rule of thumb is to sanitize anything that can be user-provided (including when it's coming from the database, or uploaded/fetched files, not just HTTP params), and only allow it to participate as a source for rendering with |
@andyw8 Your writing skills are evidently superior to mine, so who would be better than you to send a PR? |
I haven't done anything with |
Note to future self: it's possible to check/harvest for usage examples in https://github.com/eliotsykes/real-world-rails, https://github.com/pirj/real-world-rspec (slightly more up to date, but fewer Rails repos). From Rails Guides:
|
I noticed there's no mention of
#html_safe
in views and helpers. I've found this to be a commonly misused/misunderstood part of Rails, but I'm not sure if it should be considered as 'style'. Any thoughts?The text was updated successfully, but these errors were encountered: