fix: throttle conversation search endpoint to prevent abuse
This commit is contained in:
@@ -154,6 +154,12 @@ class Rack::Attack
|
||||
match_data[:account_id] if match_data.present?
|
||||
end
|
||||
|
||||
# Prevent abuse of conversation search api
|
||||
throttle('/api/v1/accounts/:account_id/conversations/search', limit: 5, period: 1.minute) do |req|
|
||||
match_data = %r{/api/v1/accounts/(?<account_id>\d+)/conversations/search}.match(req.path)
|
||||
match_data[:account_id] if match_data.present?
|
||||
end
|
||||
|
||||
## ----------------------------------------------- ##
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user