Repository navigation
security: add rate limiting (Upstash sliding window) to abusable paths (PR 1.5) - #14
Merged
Merged
Conversation
PR 1.5 of docs/MILESTONES.md (SECURITY §2.5, GUARDRAILS B7).
- config/limits.ts: authoritative limits (sign-in/up 10 per 10 min by
IP; interview create 5/h, feedback 10/day, profile update 20/h by
uid) and the verified Upstash free tier (500k commands/month, 256 MB,
10 GB, no card — RISKS R3).
- server/ratelimit: RateLimiter interface; Upstash adapter
(@upstash/ratelimit sliding window, one limiter per limit name);
in-memory limiter for dev/CI/tests; enforceLimit throws
AppError('RATE_LIMITED') with the reset time in the message.
Production refuses to boot without Upstash (config/env.ts).
- keys: IPs hashed before becoming Redis keys; uid namespaced.
- Applied to signIn/signUp (IP), createFeedback/updateProfile (uid),
and the Vapi webhook (uid → 429).
Verified: pnpm lint, typecheck, knip, vitest 55/55 (sliding-window
semantics, per-name isolation, key hashing, actions return the limit
message and skip work); next build; live burst against the real
Upstash database: 10 allowed, 11th and 12th denied.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR 1.5 of
docs/MILESTONES.md(Phase 1). SECURITY §2.5 / GUARDRAILS B7.config/limits.ts— the authoritative limits + the verified Upstash free tier (500k commands/month, 256 MB, 10 GB, no card) — R3 for Upstash doneserver/ratelimit/—RateLimiterinterface; Upstash sliding-window adapter; in-memory limiter for dev/CI/tests;enforceLimit→AppError('RATE_LIMITED')with reset time. Production refuses to boot without UpstashsignIn/signUp(IP),createFeedback/updateProfile(uid), Vapi webhook (uid → 429)Type
Verification
pnpm lint✔ ·typecheck✔ ·knip✔ ·vitest55/55 (window semantics, per-limit isolation, hashing, actions short-circuit on limit) ·next build✔1..10 ok, 11 DENIED, 12 DENIED; production server boots on the Upstash adapter (no fallback warning)Server checklist
Risk watch-list
Docs
docs/TECH_STACK.md(verified limits),docs/SECURITY.md§2.5,docs/RISKS.md,.env.exampleConfig note: add
UPSTASH_REDIS_REST_URL/UPSTASH_REDIS_REST_TOKENto Vercel before the Phase 1 release — production will not start without them.🤖 Generated with Claude Code