annotate config/initializers/content_security_policy.rb @ 255:eda83610b65c

Update rails and stuff
author nanaya <me@nanaya.net>
date Sun, 15 Dec 2024 22:45:33 +0900
parents 89f6c0016bab
children
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
254
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 223
diff changeset
3 # Define an application-wide content security policy.
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 223
diff changeset
4 # See the Securing Rails Applications Guide for more information:
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 223
diff changeset
5 # https://guides.rubyonrails.org/security.html#content-security-policy-header
185
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
6
223
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
7 # Rails.application.configure do
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
8 # config.content_security_policy do |policy|
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
9 # policy.default_src :self, :https
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
10 # policy.font_src :self, :https, :data
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
11 # policy.img_src :self, :https, :data
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
12 # policy.object_src :none
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
13 # policy.script_src :self, :https
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
14 # policy.style_src :self, :https
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
15 # # Specify URI for violation reports
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
16 # # policy.report_uri "/csp-violation-report-endpoint"
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
17 # end
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
18 #
254
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 223
diff changeset
19 # # Generate session nonces for permitted importmap, inline scripts, and inline styles.
223
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
20 # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
254
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 223
diff changeset
21 # config.content_security_policy_nonce_directives = %w(script-src style-src)
223
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
22 #
254
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 223
diff changeset
23 # # Report violations without enforcing the policy.
223
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
24 # # config.content_security_policy_report_only = true
185
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents:
diff changeset
25 # end