Skip to content

Commit

Permalink
LTI-179: Change X-Frame-Options to Content-Security-Policy (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariam05 authored Sep 12, 2022
1 parent 255045d commit 787e29e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
5 changes: 0 additions & 5 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,5 @@ class Application < Rails::Application
config.developer_mode_enabled = ENV.fetch('DEVELOPER_MODE_ENABLED', 'false').casecmp?('true')

config.generators.javascript_engine = :js

# Allow this to work in an iframe on another domain
config.action_dispatch.default_headers = {
'X-Frame-Options' => 'ALLOWALL',
}
end
end
25 changes: 13 additions & 12 deletions config/initializers/content_security_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,23 @@
# 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| # # If you are using webpack-dev-server then specify webpack-dev-server host
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
Rails.application.config.content_security_policy do |policy| # # If you are using webpack-dev-server then specify webpack-dev-server host
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?

# 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
# 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
policy.frame_ancestors('*')

# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
# Specify URI for violation reports
# policy.report_uri "/csp-violation-report-endpoint"
end

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

# Report CSP violations to a specified URI
# For further information see the following documentation:
Expand Down

0 comments on commit 787e29e

Please sign in to comment.