Files
grecia/lib/wysiwyg_sanitizer.rb
Javi Martín f917f5eed9 Filter image tags everywhere except in custom pages
Allowing image tags everywhere makes us vulnerable to CSRF attacks.
2018-09-12 12:35:28 +02:00

14 lines
268 B
Ruby

class WYSIWYGSanitizer
def allowed_tags
%w[p ul ol li strong em u s a h2 h3]
end
def allowed_attributes
%w[href]
end
def sanitize(html)
ActionController::Base.helpers.sanitize(html, tags: allowed_tags, attributes: allowed_attributes)
end
end