Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a default Content Security Policy (CSP) that is lenient yet secure #24961

wants to merge 1 commit into from
Changes from all commits
File filter

Filter by extension

Filter by extension

Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion actionpack/lib/action_dispatch/railtie.rb
Expand Up @@ -21,7 +21,9 @@ class Railtie < Rails::Railtie # :nodoc:
config.action_dispatch.default_headers = {
'X-Frame-Options' => 'SAMEORIGIN',
'X-XSS-Protection' => '1; mode=block',
'X-Content-Type-Options' => 'nosniff'
'X-Content-Type-Options' => 'nosniff',
'Content-Security-Policy' =>
"default-src 'self' https:; font-src 'self' https: data:; img-src 'self' https: data:; object-src 'none'; script-src 'self' https:; style-src 'self' https: 'unsafe-inline'"

config.eager_load_namespaces << ActionDispatch
Expand Down