Skip to content

Commit

Permalink
Add hardened headers to user-uploaded files (#25756)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire committed Jul 6, 2023
1 parent 35830cd commit f626e0d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/application.rb
Expand Up @@ -160,6 +160,10 @@ class Application < Rails::Application
end
end

config.public_file_server.headers = {
'X-Content-Type-Options' => 'nosniff',
}

# config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
# config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]

Expand Down
2 changes: 2 additions & 0 deletions dist/nginx.conf
Expand Up @@ -109,6 +109,8 @@ server {
location ~ ^/system/ {
add_header Cache-Control "public, max-age=2419200, immutable";
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
add_header X-Content-Type-Options nosniff;
add_header Content-Security-Policy "default-src 'none'; form-action 'none'";
try_files $uri =404;
}

Expand Down

0 comments on commit f626e0d

Please sign in to comment.