Prohibit calling .html_safe in views
Problem
- You bind an object/variable to be displayed in a view (ex:
unharmful
) - You know it contains some html content, so you flag it as
.html_safe
in the view - Later on you change
unharmful
to bind to another origin that includes user provided content
Because you flagged it to be .html_safe
in the view, the unsafe content gets displayed.
Proposal
Prohibit the use of .html_safe
calls in views.
By prohibiting .html_safe
usage in a view, we force it to be done either on the controller (for single variable bindings) or in a presenter (when we are binding an object, like a model), which is as close to the origin as possible.