Rails 8.2 introduces ActiveSupport notifications for CSRF events, enabling real-time monitoring of attack attempts. Three new events track token fallbacks, blocked requests, and cross-origin JavaScript attempts. Developers can subscribe to these events to build custom security monitoring, integrate with services like Datadog or
Table of contents
What’s ChangingWhy This MattersBuilding a CSRF MonitorSending Events to External ServicesAvoiding Duplicate Log EntriesUnderstanding the EventsSilencing Noisy EventsTesting Your SubscriberTriggering Events in DevelopmentWrapping UpSort: