annotate config/initializers/content_security_policy.rb @ 493:30cf29ac9294

public-path confuses sprockets
author nanaya <me@nanaya.net>
date Tue, 17 Jan 2023 02:52:30 +0900
parents 6cac8fcf8164
children 92929378413e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
459
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
1 # Be sure to restart your server when you modify this file.
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
2
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
3 # Define an application-wide content security policy
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
4 # For further information see the following documentation
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
5 # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
6
485
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
7 # Rails.application.configure do
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
8 # config.content_security_policy do |policy|
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
9 # policy.default_src :self, :https
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
10 # policy.font_src :self, :https, :data
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
11 # policy.img_src :self, :https, :data
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
12 # policy.object_src :none
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
13 # policy.script_src :self, :https
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
14 # policy.style_src :self, :https
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
15 # # Specify URI for violation reports
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
16 # # policy.report_uri "/csp-violation-report-endpoint"
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
17 # end
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
18 #
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
19 # # Generate session nonces for permitted importmap and inline scripts
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
20 # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
21 # config.content_security_policy_nonce_directives = %w(script-src)
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
22 #
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
23 # # Report CSP violations to a specified URI. See:
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
24 # # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
6cac8fcf8164 Update to rails 7 (and ruby 3.1)
nanaya <me@nanaya.pro>
parents: 467
diff changeset
25 # # config.content_security_policy_report_only = true
459
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
26 # end