Repository navigation
docs(security): rate limiting must count in a shared store across instances - #536
Merged
addyosmani merged 1 commit intoSep 3, 2026
Conversation
addyosmani
approved these changes
Aug 31, 2026
addyosmani
left a comment
Owner
There was a problem hiding this comment.
Correct and worth stating. A per-instance rate-limit counter silently fails the moment you run more than one instance, so 'count in a shared store for distributed setups' is the right addition. Small, verified clean. Approving.
This was referenced Sep 4, 2026
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.
What
## Rate Limitinginsecurity-and-hardeningis a singleexpress-rate-limitsnippet with no prose.express-rate-limitcounts in process memory by default, so the snippet as written enforcesmax × instancesbehind a load balancer and effectively nothing on serverless/edge, where each invocation can start from zero. The auth limiter (10 attempts / 15 min) is exactly the control that brute-force attackers spread across instances.This adds one paragraph naming the failure mode and the fix (a shared
store— Redis viarate-limit-redis— or an HTTP-based limiter for runtimes without a long-lived TCP connection), a short@upstash/ratelimitexample for the auth endpoint, and matching one-line updates to the existing Red Flags and Verification entries.Why here, and why not a new skill
references/security-checklist.mdL41 has the same gap ("Rate limiting on login endpoint (≤10 attempts per 15 minutes)").Disclosure
I work at Upstash, which makes
@upstash/ratelimit. The paragraph leads with the vendor-neutral fix (store+rate-limit-redis) and the example is there because an HTTP-based limiter is the only option on edge runtimes; if you would rather keep the file free of a named product, I'm happy to drop the second code block and keep the prose, or swap the example forrate-limit-redis.Pre-flight (per CONTRIBUTING)
performance-optimizationcovers caching layers but not limiters.skills/security-and-hardening/SKILL.mdor rate limiting (feat: add skill-sec — agent instructions supply-chain security auditor #523 proposes a separate supply-chain auditor skill).Scope and size
One file. Frontmatter description unchanged. The file was at 499 lines and this takes it to 513 (or 508 if the second express block is folded into the shared-store example, which I can do on request). The 500-line note in skill-anatomy.md is a guideline rather than a CI rule, but flagging it so you can decide.
Verification
node scripts/validate-skills.js→ 25 skills checked, 0 errors, 0 warningsnode scripts/run-evals.js --min-rank1 80→ 136 checks passed, rank-1 86% (72/84) — unchanged frommain(description untouched)node scripts/validate-reference-links.js→ 25 skills checked, 0 errorsgit diff --check→ clean@upstash/ratelimit2.0.8 /@upstash/redis1.38.3 (Redis.fromEnv(),Ratelimit.slidingWindow(10, '15 m'),limit()→{ success }).