How to fix: No Rate-Limit Policy Detected
No rate-limiting headers (X-RateLimit-Limit, RateLimit-Limit, Retry-After) or a 429 response were observed. Without rate-limiting, brute-force, credential stuffing, and scraping attacks can run unchecked.
Why it matters
Attackers can brute-force credentials, scrape all content, or exhaust backend resources with no request budget enforced. APIs without rate-limiting are a primary target for enumeration and DoS.
Rate-limiting controls how many requests a client can make within a time window. Without it, malicious actors can submit thousands of authentication attempts, harvest user data, or trigger expensive server operations at will.
How to fix it
- 1Add rate-limiting middleware (e.g., upstash/ratelimit, express-rate-limit, nginx limit_req).
- 2Return 429 Too Many Requests with a Retry-After header when the limit is exceeded.
- 3Return X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers on every response.
Code examples
Next.js API route (upstash/ratelimit)
import { Ratelimit } from '@upstash/ratelimit';
import { Redis } from '@upstash/redis';
const ratelimit = new Ratelimit({
redis: Redis.fromEnv(),
limiter: Ratelimit.slidingWindow(60, '1 m'),
});
export async function POST(req: Request) {
const ip = req.headers.get('x-forwarded-for') ?? '127.0.0.1';
const { success, limit, remaining, reset } = await ratelimit.limit(ip);
if (!success) {
return new Response('Too Many Requests', {
status: 429,
headers: {
'Retry-After': String(Math.ceil((reset - Date.now()) / 1000)),
'X-RateLimit-Limit': String(limit),
'X-RateLimit-Remaining': '0',
},
});
}
return Response.json({ ok: true });
}Nginx (limit_req)
http {
limit_req_zone $binary_remote_addr zone=api:10m rate=60r/m;
server {
location /api/ {
limit_req zone=api burst=10 nodelay;
limit_req_status 429;
}
}
}References
Detected automatically by VulnRadar. The check id is ratelimit-policy-missing, stable across every scan so you can filter or diff on it.
More config checks
- MediumVary: Cookie Missing on Cookie-Bearing Response
- LowSet-Cookie Header Exceeds 4 KB
- LowVary Header Missing on Compressed Responses
- InfoDownloadable Content Served as inline
- InfoX-XSS-Protection Header Is Deprecated
- LowServer-Timing Exposes Cache Timings
- LowVary: Cookie on Static Resource
- MediumCORS Endpoint Missing Vary: Origin
Questions
- How severe is No Rate-Limit Policy Detected?
- VulnRadar rates this medium severity in the config category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id ratelimit-policy-missing, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does No Rate-Limit Policy Detected map to?
- It maps to CWE-799. In the OWASP Top 10 it falls under A04:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.