Skip to content

Commit c399269

Browse files
committed
app:update config/initializers/content_security_policy.rb
1 parent d935753 commit c399269

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed
Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
11
# Be sure to restart your server when you modify this file.
22

3-
# 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
3+
# Define an application-wide 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

7-
# Rails.application.config.content_security_policy do |policy|
8-
# policy.default_src :self, :https
9-
# policy.font_src :self, :https, :data
10-
# policy.img_src :self, :https, :data
11-
# policy.object_src :none
12-
# policy.script_src :self, :https
13-
# policy.style_src :self, :https
14-
# # If you are using webpack-dev-server then specify webpack-dev-server host
15-
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
16-
17-
# # Specify URI for violation reports
18-
# # policy.report_uri "/csp-violation-report-endpoint"
7+
# Rails.application.configure do
8+
# config.content_security_policy do |policy|
9+
# policy.default_src :self, :https
10+
# policy.font_src :self, :https, :data
11+
# policy.img_src :self, :https, :data
12+
# policy.object_src :none
13+
# policy.script_src :self, :https
14+
# policy.style_src :self, :https
15+
# # Specify URI for violation reports
16+
# # policy.report_uri "/csp-violation-report-endpoint"
17+
# end
18+
#
19+
# # Generate session nonces for permitted importmap and inline scripts
20+
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21+
# config.content_security_policy_nonce_directives = %w(script-src)
22+
#
23+
# # Report violations without enforcing the policy.
24+
# # config.content_security_policy_report_only = true
1925
# end
20-
21-
# If you are using UJS then enable automatic nonce generation
22-
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
23-
24-
# Set the nonce only to specific directives
25-
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
26-
27-
# Report CSP violations to a specified URI
28-
# For further information see the following documentation:
29-
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
30-
# Rails.application.config.content_security_policy_report_only = true

0 commit comments

Comments
 (0)