annotate config/initializers/content_security_policy.rb @ 222:fefe9b0a603d

Update libraries
author nanaya <me@nanaya.pro>
date Sat, 21 Aug 2021 20:46:52 +0900
parents 2335107f35d0
children ad6264cca788
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
214
2335107f35d0 Run rails update
nanaya <me@nanaya.pro>
parents: 185
diff changeset
22 # Set the nonce only to specific directives
2335107f35d0 Run rails update
nanaya <me@nanaya.pro>
parents: 185
diff changeset
23 # Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
2335107f35d0 Run rails update
nanaya <me@nanaya.pro>
parents: 185
diff changeset
24
185
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
25 # Report CSP violations to a specified URI
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
26 # For further information see the following documentation:
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
27 # 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
28 # Rails.application.config.content_security_policy_report_only = true