Rate-limit /api/challenge endpoint
This commit is contained in:
parent
0438a5fd5f
commit
d34eac97c7
1 changed files with 8 additions and 0 deletions
|
|
@ -82,6 +82,13 @@ const loginLimiter = rateLimit({
|
|||
legacyHeaders: false,
|
||||
message: { error: 'Too many login attempts, try again later.' },
|
||||
});
|
||||
const challengeLimiter = rateLimit({
|
||||
windowMs: 15 * 60 * 1000,
|
||||
limit: 30,
|
||||
standardHeaders: 'draft-7',
|
||||
legacyHeaders: false,
|
||||
message: { error: 'Too many challenge requests, try again later.' },
|
||||
});
|
||||
const apiLimiter = rateLimit({
|
||||
windowMs: 60 * 1000,
|
||||
limit: 120,
|
||||
|
|
@ -91,6 +98,7 @@ const apiLimiter = rateLimit({
|
|||
});
|
||||
app.use('/api', apiLimiter);
|
||||
app.use('/api/login', loginLimiter);
|
||||
app.use('/api/challenge', challengeLimiter);
|
||||
|
||||
app.use('/api', (_req, res, next) => {
|
||||
res.set('Cache-Control', 'no-store');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue