fix(rate-limit): close rate-limit bypass and tighten public route limits#4591
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Applies/strengthens throttling on multiple endpoints: per-IP limits for Hardens a few abuse vectors: deduplicates public template view count increments per viewer per 10 minutes, routes Reviewed by Cursor Bugbot for commit 2f3657c. Configure here. |
Greptile SummaryThis PR closes a long-standing
Confidence Score: 5/5Safe to merge; all new rate-limit paths fail open on Redis errors and are covered by tests. The changes are additive and well-isolated: new helpers wrap an already-tested token-bucket primitive, A2A routes apply them after the existing auth guard so the IP fallback is unreachable in practice, and the copilot route migration aligns it with the rest of the v1 surface. The unknown-IP bypass fix is simple and its new behaviour is directly tested. No new auth bypass, data-loss, or crash paths were introduced. apps/sim/app/api/auth/sso/providers/route.ts — the enforceIpRateLimit call sits after getSession() inside the try block, meaning a getSession() exception silently skips IP rate limiting for unauthenticated callers (flagged in a previous review comment). Important Files Changed
Reviews (2): Last reviewed commit: "fix(rate-limit): address PR review — dro..." | Re-trigger Greptile |
…, fall back to per-IP when JWT auth lacks userId
|
@cursor review |
|
@greptile |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 2f3657c. Configure here.
Summary
enforceUserRateLimit/enforceIpRateLimithelpers and apply per-user 60/min limits to 8 A2A tool routes (previously unlimited)socket-token,telemetry,unsubscribe, and unauthenticatedsso/providersX-Forwarded-For: unknownbypass onchat otp/sso(spoofed traffic now shares one bucket)v1/copilot/chatinto the standard v1 auth+rate-limit middleware — note: 401 response shape changes from{success:false, error}to{error}to match other v1 routestimeoutto1s–1hType of Change
Testing
Tested manually. Typecheck clean. 123/123 unit tests pass. Validated rate-limit numbers against 7 days of prod CloudWatch traffic — observed peak is 5–15× under each limit.
Checklist