Skip to content

Commit

Permalink
defines content security policy (#2719)
Browse files Browse the repository at this point in the history
Co-authored-by: Sri Harsha <sriharsha.poosa@gmail.com>
  • Loading branch information
utkarsh7989 and sri49 authored Jul 8, 2024
1 parent ca39b16 commit 424a607
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions config/initializers/content_security_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy

# Rails.application.config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https

# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
Rails.application.config.content_security_policy do |policy|
policy.default_src :self, :https
policy.font_src :self, :https, :data, "*.gstatic.com *.fontawesome.com"
policy.img_src :self, :https, :data, "*.google-analytics.com *.gstatic.com *.googletagmanager.com"
policy.script_src :self, :https, :unsafe_inline, :unsafe_eval, "https://tagmanager.google.com https://www.googletagmanager.com https://apps.usw2.pure.cloud *.fontawesome.com *.google-analytics.com"
policy.style_src :self, :https, :unsafe_inline, "https://tagmanager.google.com https://www.googletagmanager.com https://fonts.googleapis.com *.fontawesome.com"
policy.media_src :self, :https, :data
end

# If you are using UJS then enable automatic nonce generation
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
Expand Down

0 comments on commit 424a607

Please sign in to comment.