Sha256: 580353a167b60a7fcb34603eabafc01339f986e27e26db30c373f507e70b7d9e
Contents?: true
Size: 584 Bytes
Versions: 4
Compression:
Stored size: 584 Bytes
Contents
module CspReport class CspDeclarationGenerator < Rails::Generators::Base desc "Adds the Content-Security-Policy directive in all the responses" def setup_filter inject_into_file "app/controllers/application_controller.rb", after: "ApplicationController < ActionController::Base\n" do <<-CONTENT before_filter :csp def csp policy = "default *;" policy << "script-src 'self';" policy << "report-uri /\#{CspReport::MOUNT_POINT}/csp_reports" response.headers['Content-Security-Policy'] = policy end CONTENT end end end end
Version data entries
4 entries across 4 versions & 1 rubygems