Skip to content

Commit 39c4a5c

Browse files
committed
Disable CSP by default
Before this patch, to be able to use webpacker and webconsole we were defining an used default in the script-src policy. White we don't implement the automatic nonce approach defined in rails#31689 it is better to not have any default configuration in Rails 5.2.
1 parent 889eb91 commit 39c4a5c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
# For further information see the following documentation
55
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
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, :unsafe_inline
13-
policy.style_src :self, :https, :unsafe_inline
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, :unsafe_inline
1414

15-
# Specify URI for violation reports
16-
# policy.report_uri "/csp-violation-report-endpoint"
17-
end
15+
# # Specify URI for violation reports
16+
# # policy.report_uri "/csp-violation-report-endpoint"
17+
# end
1818

1919
# Report CSP violations to a specified URI
2020
# For further information see the following documentation:

0 commit comments

Comments
 (0)