FEATURE: Treat site settings as plain text and add a new HTML type. (#12618)

To add an extra layer of security, we sanitize settings before shipping them to the client. We don't sanitize those that have the "html" type.

The CookedPostProcessor already uses Loofah for sanitization, so I chose to also use it for this. I added it to our gemfile since we installed it as a transitive dependency.
This commit is contained in:
Roman Rizzi
2021-04-07 12:51:19 -03:00
committed by GitHub
parent 11e611f845
commit 5e4c0e2caa
11 changed files with 74 additions and 8 deletions

View File

@ -6,7 +6,10 @@ class Admin::SiteSettingsController < Admin::AdminController
end
def index
render_json_dump(site_settings: SiteSetting.all_settings, diags: SiteSetting.diags)
render_json_dump(
site_settings: SiteSetting.all_settings(sanitize_plain_text_settings: true),
diags: SiteSetting.diags
)
end
def update