mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #43968 from sabljak/sabljak/remove-x-download-options
Remove X-Download-Options default header
This commit is contained in:
commit
9188b49883
5 changed files with 27 additions and 4 deletions
|
@ -333,14 +333,13 @@ class ResponseTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
test "read x_frame_options, x_content_type_options, x_xss_protection, x_download_options and x_permitted_cross_domain_policies, referrer_policy" do
|
||||
test "read x_frame_options, x_content_type_options, x_xss_protection, x_permitted_cross_domain_policies and referrer_policy" do
|
||||
original_default_headers = ActionDispatch::Response.default_headers
|
||||
begin
|
||||
ActionDispatch::Response.default_headers = {
|
||||
"X-Frame-Options" => "DENY",
|
||||
"X-Content-Type-Options" => "nosniff",
|
||||
"X-XSS-Protection" => "0",
|
||||
"X-Download-Options" => "noopen",
|
||||
"X-Permitted-Cross-Domain-Policies" => "none",
|
||||
"Referrer-Policy" => "strict-origin-when-cross-origin"
|
||||
}
|
||||
|
@ -352,7 +351,6 @@ class ResponseTest < ActiveSupport::TestCase
|
|||
assert_equal("DENY", resp.headers["X-Frame-Options"])
|
||||
assert_equal("nosniff", resp.headers["X-Content-Type-Options"])
|
||||
assert_equal("0", resp.headers["X-XSS-Protection"])
|
||||
assert_equal("noopen", resp.headers["X-Download-Options"])
|
||||
assert_equal("none", resp.headers["X-Permitted-Cross-Domain-Policies"])
|
||||
assert_equal("strict-origin-when-cross-origin", resp.headers["Referrer-Policy"])
|
||||
ensure
|
||||
|
|
|
@ -1038,7 +1038,6 @@ config.action_dispatch.default_headers = {
|
|||
'X-Frame-Options' => 'SAMEORIGIN',
|
||||
'X-XSS-Protection' => '0',
|
||||
'X-Content-Type-Options' => 'nosniff',
|
||||
'X-Download-Options' => 'noopen',
|
||||
'X-Permitted-Cross-Domain-Policies' => 'none',
|
||||
'Referrer-Policy' => 'strict-origin-when-cross-origin'
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
* Remove default `X-Download-Options` header
|
||||
|
||||
This header is currently only used by Internet Explorer which
|
||||
will be discontinued in 2022 and since Rails 7 does not fully
|
||||
support Internet Explorer this header should not be a default one.
|
||||
|
||||
*Harun Sabljaković*
|
||||
|
||||
Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/railties/CHANGELOG.md) for previous changes.
|
||||
|
|
|
@ -257,6 +257,16 @@ module Rails
|
|||
end
|
||||
when "7.1"
|
||||
load_defaults "7.0"
|
||||
|
||||
if respond_to?(:action_dispatch)
|
||||
action_dispatch.default_headers = {
|
||||
"X-Frame-Options" => "SAMEORIGIN",
|
||||
"X-XSS-Protection" => "0",
|
||||
"X-Content-Type-Options" => "nosniff",
|
||||
"X-Permitted-Cross-Domain-Policies" => "none",
|
||||
"Referrer-Policy" => "strict-origin-when-cross-origin"
|
||||
}
|
||||
end
|
||||
else
|
||||
raise "Unknown version #{target_version.to_s.inspect}"
|
||||
end
|
||||
|
|
|
@ -8,3 +8,13 @@
|
|||
#
|
||||
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
|
||||
|
||||
# Remove the default X-Download-Options headers since it is used only by Internet Explorer.
|
||||
# If you need to support Internet Explorer, add back `"X-Download-Options" => "noopen"`.
|
||||
# Rails.application.config.action_dispatch.default_headers = {
|
||||
# "X-Frame-Options" => "SAMEORIGIN",
|
||||
# "X-XSS-Protection" => "0",
|
||||
# "X-Content-Type-Options" => "nosniff",
|
||||
# "X-Permitted-Cross-Domain-Policies" => "none",
|
||||
# "Referrer-Policy" => "strict-origin-when-cross-origin"
|
||||
# }
|
||||
|
|
Loading…
Reference in a new issue