Skip to content

Commit ba3ff2d

Browse files
committed
Improve CSP initializer copy
The `content_security_policy_report_only` config does not enable violation reporting. It makes sure the policy isn't enforced, only reported. Also link to the guide instead of external documentation.
1 parent ce1806d commit ba3ff2d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

railties/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Be sure to restart your server when you modify this file.
22

33
# Define an application-wide content security policy.
4-
# For further information see the following documentation:
5-
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
4+
# See the Securing Rails Applications Guide for more information:
5+
# https://guides.rubyonrails.org/security.html#content-security-policy-header
66

77
# Rails.application.configure do
88
# config.content_security_policy do |policy|
@@ -20,7 +20,6 @@
2020
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
2121
# config.content_security_policy_nonce_directives = %w(script-src)
2222
#
23-
# # Report CSP violations to a specified URI. See:
24-
# # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
23+
# # Report violations without enforcing the policy.
2524
# # config.content_security_policy_report_only = true
2625
# end

0 commit comments

Comments
 (0)