aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Error/rateLimit.ts
Commit message (Collapse)AuthorAgeFilesLines
* fix(security): make rate limiting real; limit the click counter (L8/L10)Fuwn24 hours1-7/+57
| | | | | | | | | | | | | | | | | | rateLimit.ts built a new in-memory RateLimiter inside the function on every call, so its store was always empty and it never limited anything. Rewrite as module-level singletons: auth/mutation/read IP classes returning 429, plus a click-counter limiter keyed on (IP, badge) so a viewer browsing many different badges isn't throttled while hammering one badge is capped. Wire the counter into PUT /api/badges?incrementClickCount (L10). Add a pluggable RateLimiterStore seam (in-memory default, Upstash/Vercel KV ready) and document the serverless per-region caveat. Add docs/vercel-firewall.md with the dashboard WAF rate-limit rule spec (Hobby 1-rule vs Pro) for coarse per-IP edge protection — keys the app limiters can't express at the edge. Verified locally: same-badge hits 200,200,429,429…; a different badge stays 200; a no-origin hit is rate-checked then 401.
* chore(biome): drop formatter style overridesFuwn2026-03-011-6/+6
|
* chore(prettier): use spaces instead of tabsFuwn2024-10-091-4/+4
|
* refactor(utility): move helpers to utilityFuwn2024-01-131-0/+12