Fix CSP reporting endpoitn. Fix the SER for CSP
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / system-test (push) Has been cancelled

This commit is contained in:
Dan Milne
2025-11-04 23:22:15 +11:00
parent 6049429a41
commit 631b2b53bb
3 changed files with 14 additions and 10 deletions

View File

@@ -6,9 +6,9 @@ Rails.application.config.after_initialize do
if defined?(Sentry) && Sentry.initialized?
module CspViolationSentrySubscriber
def self.emit(event_data)
def self.emit(event)
# Extract relevant CSP violation data
csp_data = event_data[:data] || {}
csp_data = event[:payload] || {}
# Build a descriptive message for Sentry
violated_directive = csp_data[:violated_directive]
@@ -111,7 +111,7 @@ Rails.application.config.after_initialize do
end
# Register the subscriber for CSP violation events
Rails.event.subscribe("csp.violation", CspViolationSentrySubscriber)
Rails.event.subscribe(CspViolationSentrySubscriber)
Rails.logger.info "CSP violation Sentry subscriber registered"
else