From 28f58b3694dd78f97ba4ddd69f02c59bf2c20040 Mon Sep 17 00:00:00 2001 From: Vishnu Narayanan Date: Tue, 10 Mar 2026 14:11:36 +0530 Subject: [PATCH] fix: make conversation transcript rate limit configurable (#13740) ## Summary - The conversation transcript endpoint rate limit is hardcoded at 30 requests/hour per account with no way to override it - Self-hosted users with active accounts hit this limit and get 429 errors across all channels - Add `RATE_LIMIT_CONVERSATION_TRANSCRIPT` env var (default: `1000`) to make it configurable, consistent with other throttles like `RATE_LIMIT_CONTACT_SEARCH` and `RATE_LIMIT_REPORTS_API_ACCOUNT_LEVEL` --- config/initializers/rack_attack.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb index b193c2e14..db7be0e43 100644 --- a/config/initializers/rack_attack.rb +++ b/config/initializers/rack_attack.rb @@ -185,7 +185,8 @@ class Rack::Attack ###-----------------------------------------------### ## Prevent Abuse of Converstion Transcript APIs ### - throttle('/api/v1/accounts/:account_id/conversations/:conversation_id/transcript', limit: 30, period: 1.hour) do |req| + throttle('/api/v1/accounts/:account_id/conversations/:conversation_id/transcript', + limit: ENV.fetch('RATE_LIMIT_CONVERSATION_TRANSCRIPT', '1000').to_i, period: 1.hour) do |req| match_data = %r{/api/v1/accounts/(?\d+)/conversations/(?\d+)/transcript}.match(req.path) match_data[:account_id] if match_data.present? end