content_security_policy.rb 720 B

123456789101112131415161718192021222324252627
  1. # frozen_string_literal: true
  2. module Api::ContentSecurityPolicy
  3. extend ActiveSupport::Concern
  4. included do
  5. content_security_policy do |policy|
  6. # Set every directive that does not have a fallback
  7. policy.default_src :none
  8. policy.frame_ancestors :none
  9. policy.form_action :none
  10. # Disable every directive with a fallback to cut on response size
  11. policy.base_uri false
  12. policy.font_src false
  13. policy.img_src false
  14. policy.style_src false
  15. policy.media_src false
  16. policy.frame_src false
  17. policy.manifest_src false
  18. policy.connect_src false
  19. policy.script_src false
  20. policy.child_src false
  21. policy.worker_src false
  22. end
  23. end
  24. end