annotate config/initializers/content_security_policy.rb @ 462:e8d6c631a55b

Update gems
author nanaya <me@nanaya.pro>
date Sun, 09 Dec 2018 03:15:59 +0900
parents 07d6c6639adf
children fd3078b4d355
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
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
7 # Rails.application.config.content_security_policy do |policy|
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
8 # policy.default_src :self, :https
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
9 # policy.font_src :self, :https, :data
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
10 # policy.img_src :self, :https, :data
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
11 # policy.object_src :none
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
12 # policy.script_src :self, :https
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
13 # policy.style_src :self, :https
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
14
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
15 # # Specify URI for violation reports
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
16 # # policy.report_uri "/csp-violation-report-endpoint"
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
17 # end
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
18
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
19 # If you are using UJS then enable automatic nonce generation
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
20 # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
21
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
22 # Report CSP violations to a specified URI
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
23 # For further information see the following documentation:
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
24 # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
25 # Rails.application.config.content_security_policy_report_only = true