summaryrefslogtreecommitdiff
path: root/app/controllers/csp_reports_controller.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-19 16:16:43 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-19 16:16:43 +0200
commite0c2d7a066793683a911bee7f7210d80eb6b2055 (patch)
tree91967742cbe245806776d0dd470ad7f4ec72abe0 /app/controllers/csp_reports_controller.rb
parent042d99ec0e9095e46642d6f20932754025fd8af5 (diff)
Log CSP violations to their own file instead of relying on Rails.logger
Diffstat (limited to 'app/controllers/csp_reports_controller.rb')
-rw-r--r--app/controllers/csp_reports_controller.rb4
1 files changed, 2 insertions, 2 deletions
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
12 if report 12 if report
13 directive = report["effective-directive"] || report["violated-directive"] 13 directive = report["effective-directive"] || report["violated-directive"]
14 at = (URI.parse(report["document-uri"]).path rescue "unparsed") 14 at = (URI.parse(report["document-uri"]).path rescue "unparsed")
15 Rails.logger.warn("CSP violation: #{directive} blocked=#{report['blocked-uri']} at=#{at}") 15 CSP_LOGGER.warn("CSP violation: #{directive} blocked=#{report['blocked-uri']} at=#{at}")
16 else 16 else
17 Rails.logger.warn("CSP violation: unparseable report (#{raw.to_s.bytesize} bytes)") 17 CSP_LOGGER.warn("CSP violation: unparseable report (#{raw.to_s.bytesize} bytes)")
18 end 18 end
19 19
20 head :no_content 20 head :no_content