Skip to content

Commit

Permalink
add CSP
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamfall authored and matthewford committed Aug 8, 2024
1 parent 2eca927 commit 2ebfab9
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions config/initializers/content_security_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@
# See the Securing Rails Applications Guide for more information:
# https://guides.rubyonrails.org/security.html#content-security-policy-header

# Rails.application.configure do
# 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.configure do
config.content_security_policy do |policy|
policy.default_src :self, :https
policy.font_src :self, :https, :data

Check failure on line 10 in config/initializers/content_security_policy.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/ExtraSpacing: Unnecessary spacing detected.
policy.img_src :self, :https, :data

Check failure on line 11 in config/initializers/content_security_policy.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/ExtraSpacing: Unnecessary spacing detected.
policy.connect_src :self, :https, "ws://#{ENV["PUSHER_SOCKET_HOST"]}:#{ENV["PUSHER_WS_PORT"]}" if ENV["PUSHER_SOCKET_HOST"].present?
policy.object_src :none

Check failure on line 13 in config/initializers/content_security_policy.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/ExtraSpacing: Unnecessary spacing detected.
policy.script_src :self, "cdn.ckeditor.com", "www.clarity.ms", :unsafe_inline, :unsafe_eval, :https

Check failure on line 14 in config/initializers/content_security_policy.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/ExtraSpacing: Unnecessary spacing detected.
policy.style_src :self, "cdn.ckeditor.com", :https, :unsafe_inline

Check failure on line 15 in config/initializers/content_security_policy.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/ExtraSpacing: Unnecessary spacing detected.
# Specify URI for violation reports
# policy.report_uri "/csp-violation-report-endpoint"
end
#
# # Generate session nonces for permitted importmap and inline scripts
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
# config.content_security_policy_nonce_directives = %w(script-src)
#
# # Report violations without enforcing the policy.
# # config.content_security_policy_report_only = true

Check failure on line 25 in config/initializers/content_security_policy.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/CommentIndentation: Incorrect indentation detected (column 0 instead of 2).
# end
end

0 comments on commit 2ebfab9

Please sign in to comment.