]> git.openstreetmap.org Git - chef.git/commitdiff
Put CSP in enforcing mode
authorTom Hughes <tom@compton.nu>
Tue, 22 May 2018 08:01:13 +0000 (09:01 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 22 May 2018 08:01:56 +0000 (09:01 +0100)
cookbooks/web/recipes/rails.rb
cookbooks/web/resources/rails_port.rb

index d5f34cbf7de49d224b178a4a82267a847589593d..ab6c4e7f2886ea3ebbfd39af3038e2c07b200bca 100644 (file)
@@ -90,7 +90,7 @@ rails_port "www.openstreetmap.org" do
   mapzen_valhalla_key web_passwords["mapzen_valhalla_key"]
   thunderforest_key web_passwords["thunderforest_key"]
   totp_key web_passwords["totp_key"]
-  csp_report_url "https://openstreetmap.report-uri.io/r/default/csp/reportOnly"
+  csp_enforce true
 end
 
 package "libjson-xs-perl"
index d53cac8811e8266a09f958714989064e99df2a13..1c95dd8dc4b2a0fbcabeb5e51bb7ee0faf1f30c7 100644 (file)
@@ -65,6 +65,7 @@ property :mapquest_key, String
 property :mapzen_valhalla_key, String
 property :thunderforest_key, String
 property :totp_key, String
+property :csp_enforce, [TrueClass, FalseClass], :default => false
 property :csp_report_url, String
 property :piwik_configuration, Hash
 
@@ -264,6 +265,10 @@ action :create do
       line.gsub!(/^( *)#totp_key:.*$/, "\\1totp_key: \"#{new_resource.totp_key}\"")
     end
 
+    if new_resource.csp_enforce
+      line.gsub!(/^( *)csp_enforce:.*$/, "\\1csp_enforce: \"#{new_resource.csp_enforce}\"")
+    end
+
     if new_resource.csp_report_url
       line.gsub!(/^( *)#csp_report_url:.*$/, "\\1csp_report_url: \"#{new_resource.csp_report_url}\"")
     end