You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
1.0 KiB

  1. # Define an application-wide content security policy
  2. # For further information see the following documentation
  3. # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
  4. assets_host = Rails.configuration.action_controller.asset_host || "https://#{ENV['WEB_DOMAIN'] || ENV['LOCAL_DOMAIN']}"
  5. Rails.application.config.content_security_policy do |p|
  6. p.base_uri :none
  7. p.default_src :none
  8. p.frame_ancestors :none
  9. p.script_src :self, assets_host
  10. p.font_src :self, assets_host
  11. p.img_src :self, :https, :data, :blob
  12. p.style_src :self, :unsafe_inline, assets_host
  13. p.media_src :self, :data, assets_host
  14. p.frame_src :self, :https
  15. p.connect_src :self, assets_host, Rails.configuration.x.streaming_api_base_url
  16. end
  17. # Report CSP violations to a specified URI
  18. # For further information see the following documentation:
  19. # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
  20. # Rails.application.config.content_security_policy_report_only = true