From e0c2d7a066793683a911bee7f7210d80eb6b2055 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sun, 19 Jul 2026 16:16:43 +0200 Subject: Log CSP violations to their own file instead of relying on Rails.logger --- app/controllers/csp_reports_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/controllers/csp_reports_controller.rb b/app/controllers/csp_reports_controller.rb index a8f8edb..5a3b55e 100644 --- a/app/controllers/csp_reports_controller.rb +++ b/app/controllers/csp_reports_controller.rb @@ -12,9 +12,9 @@ class CspReportsController < ApplicationController if report directive = report["effective-directive"] || report["violated-directive"] at = (URI.parse(report["document-uri"]).path rescue "unparsed") - Rails.logger.warn("CSP violation: #{directive} blocked=#{report['blocked-uri']} at=#{at}") + CSP_LOGGER.warn("CSP violation: #{directive} blocked=#{report['blocked-uri']} at=#{at}") else - Rails.logger.warn("CSP violation: unparseable report (#{raw.to_s.bytesize} bytes)") + CSP_LOGGER.warn("CSP violation: unparseable report (#{raw.to_s.bytesize} bytes)") end head :no_content -- cgit v1.3