Repository navigation
Forward a keyed client id so the backend can rate-limit per client - #338
devin-ai-integration[bot] merged 1 commit into
Conversation
…lient rate limits Co-Authored-By: Chad <chadnuttall1@gmail.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Sorry @devin-ai-integration[bot], this account has used its review budget of 1,500,000 diff characters for the last 7 days. You can request another review in 1 hour and 58 minutes by commenting |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedBot user detected. Ask an organization administrator to verify that this bot has an active assigned CodeRabbit review seat. See the seat-assignment guide. After the seat is confirmed, request a review again.
|
Summary
Paired with spizeck/contract-builder (branch
devin/1796220473-per-client-ingest-rate-limits). Remediates code-scan findingssfind-760ad61b918441049ee645fd8ee3ec7dandsfind-4e6203b8a6df49f6b33cf40d309d77a3./api/support-requestsand/api/newsletter/{subscribe,confirm,unsubscribe}forwarded every anonymous visitor with one shared Bearer key and no client identity. One client could therefore use up the backend's single global per-minute bucket for everyone.New
lib/client-rate-key.tsis used at the forwarding boundary (submitSupportRequest,postToBackend):Verification (base
66e877a)npm test→ 55 files / 791 tests passed. New tests cover: the keyed hash is forwarded on all four routes and the raw IP never appears in headers or body; with a simulated per-client backend, a flooding client gets 429rate_limitedwhile another client's support request, signup, confirm and unsubscribe all succeed; no header is sent without an IP.npm run lint,npm run typecheck→ clean.npm run build→ success.newsletter-footer,newsletter-attribution,interactive-content,smokeondesktop-chromium+mobile-chromium→ 82 passed.Optional Vercel Firewall layer (not applied)
This is defense in depth at the edge, before any function runs. Stage it with
log, watch it, then switch todeny: a custom rule onPOSTwith path matching^/api/(support-requests|newsletter/(subscribe|confirm|unsubscribe))$→rate_limit, keyip, about 30 req / 60 s. Counters are per region, so keep the limit generous.Not done: no deploy, no env changes, no firewall changes.
Link to Devin session: https://app.devin.ai/sessions/763a718ce3054aee8a5ac6580ae34c27
Open in Devin Desktop: https://app.devin.ai/desktop/session/763a718ce3054aee8a5ac6580ae34c27?variant=devin
Requested by: @spizeck
🟢 Devin Review found nothing to fix · View findings