Enable Rails framework 7.0's isolation_level, partial_inserts, & raise_on_open_redirects (#17970)

This commit is contained in:
Mac Siri 2022-06-23 10:30:58 -04:00 committed by GitHub
parent abeff25ec0
commit 2f029fe896
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -61,8 +61,9 @@ class SocialPreviewsController < ApplicationController
end
format.png do
html = render_to_string(template, formats: :html, layout: false)
redirect_to HtmlCssToImage.fetch_url(html: html, css: PNG_CSS,
google_fonts: I18n.t("social_previews_controller.fonts")), status: :found
url = HtmlCssToImage.fetch_url(html: html, css: PNG_CSS,
google_fonts: I18n.t("social_previews_controller.fonts"))
redirect_to url, allow_other_host: true, status: :found
end
end
end

View file

@ -50,7 +50,7 @@ Rails.application.config.active_support.executor_around_test_case = true
# Define the isolation level of most of Rails internal state.
# If you use a fiber based server or job processor, you should set it to `:fiber`.
# Otherwise the default of `:thread` if preferable.
# Rails.application.config.active_support.isolation_level = :thread
Rails.application.config.active_support.isolation_level = :thread
# Set both the `:open_timeout` and `:read_timeout` values for `:smtp` delivery method.
Rails.application.config.action_mailer.smtp_timeout = 5
@ -64,10 +64,10 @@ Rails.application.config.active_record.verify_foreign_keys_for_fixtures = true
# Disable partial inserts.
# This default means that all columns will be referenced in INSERT queries
# regardless of whether they have a default or not.
# Rails.application.config.active_record.partial_inserts = false
Rails.application.config.active_record.partial_inserts = false
#
# Protect from open redirect attacks in `redirect_back_or_to` and `redirect_to`.
# Rails.application.config.action_controller.raise_on_open_redirects = true
Rails.application.config.action_controller.raise_on_open_redirects = true
# If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer
# was `:marshal`. Convert all cookies to JSON, using the `:hybrid` formatter.