annotate config/initializers/content_security_policy.rb @ 213:609e96a79ad8

Update defaults
author nanaya <me@nanaya.pro>
date Fri, 11 Dec 2020 03:41:31 +0900
parents f67f3ad50270
children 2335107f35d0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
185
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
1 # Be sure to restart your server when you modify this file.
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
2
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
3 # Define an application-wide content security policy
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
4 # For further information see the following documentation
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
5 # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
6
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
7 # Rails.application.config.content_security_policy do |policy|
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
8 # policy.default_src :self, :https
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
9 # policy.font_src :self, :https, :data
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
10 # policy.img_src :self, :https, :data
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
11 # policy.object_src :none
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
12 # policy.script_src :self, :https
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
13 # policy.style_src :self, :https
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
14
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
15 # # Specify URI for violation reports
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
16 # # policy.report_uri "/csp-violation-report-endpoint"
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
17 # end
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
18
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
19 # If you are using UJS then enable automatic nonce generation
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
20 # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
21
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
22 # Report CSP violations to a specified URI
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
23 # For further information see the following documentation:
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
24 # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
25 # Rails.application.config.content_security_policy_report_only = true