Mercurial > rsstweet
comparison config/initializers/content_security_policy.rb @ 223:ad6264cca788
Update to rails 7
author | nanaya <me@nanaya.pro> |
---|---|
date | Sat, 15 Jan 2022 02:39:53 +0900 |
parents | 2335107f35d0 |
children | 89f6c0016bab |
comparison
equal
deleted
inserted
replaced
222:fefe9b0a603d | 223:ad6264cca788 |
---|---|
2 | 2 |
3 # Define an application-wide content security policy | 3 # Define an application-wide content security policy |
4 # For further information see the following documentation | 4 # For further information see the following documentation |
5 # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy | 5 # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy |
6 | 6 |
7 # Rails.application.config.content_security_policy do |policy| | 7 # Rails.application.configure do |
8 # policy.default_src :self, :https | 8 # config.content_security_policy do |policy| |
9 # policy.font_src :self, :https, :data | 9 # policy.default_src :self, :https |
10 # policy.img_src :self, :https, :data | 10 # policy.font_src :self, :https, :data |
11 # policy.object_src :none | 11 # policy.img_src :self, :https, :data |
12 # policy.script_src :self, :https | 12 # policy.object_src :none |
13 # policy.style_src :self, :https | 13 # policy.script_src :self, :https |
14 | 14 # policy.style_src :self, :https |
15 # # Specify URI for violation reports | 15 # # Specify URI for violation reports |
16 # # policy.report_uri "/csp-violation-report-endpoint" | 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 CSP violations to a specified URI. See: | |
24 # # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only | |
25 # # config.content_security_policy_report_only = true | |
17 # end | 26 # end |
18 | |
19 # If you are using UJS then enable automatic nonce generation | |
20 # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } | |
21 | |
22 # Set the nonce only to specific directives | |
23 # Rails.application.config.content_security_policy_nonce_directives = %w(script-src) | |
24 | |
25 # Report CSP violations to a specified URI | |
26 # For further information see the following documentation: | |
27 # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only | |
28 # Rails.application.config.content_security_policy_report_only = true |