Merge pull request #4000 from betagouv/feat/enable-csp-in-prod

enable csp
This commit is contained in:
Keirua 2019-07-01 09:36:34 +02:00 committed by GitHub
commit 8febe8c21f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 5 deletions

View file

@ -59,7 +59,7 @@ Rails.application.configure do
port: 3000
}
# Use Content-Security-Policy-Report-Only instead of Content-Security-Policy
# Use Content-Security-Policy-Report-Only headers
config.content_security_policy_report_only = true
# Raises error for missing translations

View file

@ -109,7 +109,8 @@ Rails.application.configure do
host: ENV['APP_HOST']
}
config.content_security_policy_report_only = true
# The Content-Security-Policy is NOT in Report-Only mode
config.content_security_policy_report_only = false
config.lograge.enabled = ENV['LOGRAGE_ENABLED'] == 'enabled'
end

View file

@ -45,7 +45,7 @@ Rails.application.configure do
protocol: :http
}
# Use Content-Security-Policy-Report-Only instead of Content-Security-Policy
# Use Content-Security-Policy-Report-Only headers
config.content_security_policy_report_only = true
config.active_job.queue_adapter = :test

View file

@ -13,8 +13,8 @@ Rails.application.config.content_security_policy do |policy|
# Pour les CSS, on a beaucoup de style inline et quelques balises <style>
# c'est trop compliqué pour être rectifié immédiatement (et sans valeur ajoutée:
# c'est hardcodé dans les vues, donc pas injectable).
policy.style_src :self, :unsafe_inline, "*.crisp.chat", "crisp.chat"
policy.connect_src "wss://*.crisp.chat"
policy.style_src :self, "*.crisp.chat", "crisp.chat", :unsafe_inline
policy.connect_src :self, "wss://*.crisp.chat"
# Pour tout le reste, par défaut on accepte uniquement ce qui vient de chez nous
# et dans la notification on inclue la source de l'erreur
policy.default_src :self, :data, :report_sample, "fonts.gstatic.com", "in-automate.sendinblue.com", "player.vimeo.com", "app.franceconnect.gouv.fr", "sentry.io", "static.demarches-simplifiees.fr", "*.crisp.chat", "crisp.chat", "*.sibautomation.com", "sibautomation.com", "data"