Skip to content

Commit 492ec9e

Browse files
committed
Security Header と HTML5 Sanitizer の設定を追加
1 parent 456d414 commit 492ec9e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

config/application.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,17 @@ class Application < Rails::Application
3232

3333
# Default I18n locale
3434
config.i18n.default_locale = :ja
35+
36+
# セキュリティヘッダーの設定
37+
config.action_dispatch.default_headers = {
38+
"X-Frame-Options" => "SAMEORIGIN",
39+
"X-XSS-Protection" => "0",
40+
"X-Content-Type-Options" => "nosniff",
41+
"X-Permitted-Cross-Domain-Policies" => "none",
42+
"Referrer-Policy" => "strict-origin-when-cross-origin"
43+
}
44+
45+
# HTML5サニタイザーの使用
46+
config.action_view.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
3547
end
3648
end

0 commit comments

Comments
 (0)