annotate config/initializers/content_security_policy.rb @ 459:07d6c6639adf

Upgrade to rails 5.2. RIP code style.
author nanaya <me@nanaya.pro>
date Sat, 14 Apr 2018 04:19:52 +0900
parents
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