Safeguard against DoS in Rails helper - Dogs with sunglasses - Hey, Darius here
23-Jun-2025 35
One recent contribution to the Rails codebase caught my attention. It concerns the distance_of_time_in_words method. The fix is meant to prevent a possible Denial of Service while using this method.
The contribution was brought by Stazer. I found out about the PR in the newsletter This week in Rails.
The problem
The distance_of_time_in_words method returns the approximate distance in time between two timeframes (can be Time, Date, or DateTime objects or integers) and displays it in a nice, humanized format. To be correct, the leap years between those two timeframes should be considered. It uses count and a range to get the number of leap years.
Safeguard against DoS in Rails helper - Dogs with sunglasses - Hey, Darius here #ruby #rubydeveloper #rubyonrails #Safeguard #against #Rails #helper #sunglasses #Darius https://rubyonrails.ba/link/safeguard-against-dos-in-rails-helper-dogs-with-sunglasses-hey-darius-here