skills/limit-request-rate-pattern/SKILL.md
Security pattern for implementing rate limiting and throttling. Use when protecting against brute-force attacks, DoS/DDoS mitigation, preventing resource exhaustion, or limiting API abuse. Addresses "Entity absorbs excessive resources" problem.
npx skillsauth add igbuend/grimbard limit-request-rate-patternInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Limits the number of requests an entity can make within a given timeframe, preventing resource exhaustion and brute-force attacks.
Entity absorbs excessive resources: An attacker floods the system with requests, either to:
| Role | Type | Responsibility | |------|------|----------------| | Entity | Entity | Makes requests to system | | Enforcer | Enforcement Point | Intercepts and rate-checks requests | | Limiter | Decision Point | Decides if request within limits | | Policy Provider | Information Point | Manages rate limit rules | | History Store | Storage | Tracks request history per entity |
Entity → [action] → Enforcer
Enforcer → [check(id)] → Limiter
Limiter → [get_policy(id)] → Policy Provider
Policy Provider → [policy] → Limiter
Limiter → [get_history(id)] → History Store
History Store → [history] → Limiter
Limiter → [allowed/denied] → Enforcer
Enforcer → [action] → System (if allowed)
→ [429 Too Many Requests] → Entity (if denied)
How to identify entities for rate limiting:
| Identifier | Pros | Cons | |------------|------|------| | IP Address | Simple, no auth needed | NAT/proxy issues, IPv6 abundant | | User/API Key | Accurate per-user | Requires authentication | | Session ID | Works for logged-in users | Session rotation may reset | | Combination | More precise | Complex implementation |
Recommendation: Use multiple identifiers where possible.
Define policies based on:
Example policies:
/login: 5 requests per minute per IP
/api/search: 100 requests per minute per API key
/api/export: 10 requests per hour per user
Inform clients of limits:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1640000000
Retry-After: 60
Recommendation: Defense in depth—use multiple levels.
development
Security anti-pattern for Cross-Site Scripting vulnerabilities (CWE-79). Use when generating or reviewing code that renders HTML, handles user input in web pages, uses innerHTML/document.write, or builds dynamic web content. Covers Reflected, Stored, and DOM-based XSS. AI code has 86% XSS failure rate.
development
Security anti-pattern for XPath injection vulnerabilities (CWE-643). Use when generating or reviewing code that queries XML documents, constructs XPath expressions, or handles user input in XML operations. Detects unescaped quotes and special characters in XPath queries.
development
Security anti-pattern for weak password hashing (CWE-327, CWE-759). Use when generating or reviewing code that stores or verifies user passwords. Detects use of MD5, SHA1, SHA256 without salt, or missing password hashing entirely. Recommends bcrypt, Argon2, or scrypt.
development
Security anti-pattern for weak encryption (CWE-326, CWE-327). Use when generating or reviewing code that encrypts data, handles encryption keys, or uses cryptographic modes. Detects DES, ECB mode, static IVs, and custom crypto implementations.