Files
romm/backend/utils
Georges-Antoine AssiandClaude Opus 5 17044f652b Rate limit the unauthenticated metadata heartbeat endpoint
GET /heartbeat/metadata/{source} needs no authentication and each call
probes a third-party API through that provider's process-global outbound
limiter, so an unthrottled caller could queue up enough probes to starve
scans and burn the API quota.

Cap it at 20 requests per minute per IP per source. The limit is applied
after the source is parsed, so an invalid source still gets a cheap 400
and arbitrary path values cannot grow the Redis keyspace.

The incr/expire/429 block this needed already existed twice, so extract
it into utils/rate_limit.py and point the device authorization and client
token exchange limits at it. The device auth behaviour is unchanged; the
client token exchange window is now fixed rather than refreshing its TTL
on every request, matching the comment device auth already carried.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 21:42:48 -04:00
..
2025-09-04 11:17:00 -03:00
2026-07-26 15:16:56 -04:00
2026-08-01 14:52:55 -04:00
2026-07-20 08:39:34 -04:00
2026-06-28 21:48:50 -04:00
2026-07-06 22:17:56 -04:00