mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
feat: rate limit user creation (#3468)
This commit is contained in:
parent
d33f11511a
commit
14a2ca700c
@ -39,6 +39,8 @@ import {
|
||||
} from '../../openapi/spec/users-groups-base-schema';
|
||||
import { IGroup } from '../../types/group';
|
||||
import { IFlagResolver } from '../../types/experimental';
|
||||
import rateLimit from 'express-rate-limit';
|
||||
import { minutesToMilliseconds } from 'date-fns';
|
||||
|
||||
export default class UserAdminController extends Controller {
|
||||
private flagResolver: IFlagResolver;
|
||||
@ -202,6 +204,12 @@ export default class UserAdminController extends Controller {
|
||||
requestBody: createRequestSchema('createUserSchema'),
|
||||
responses: { 200: createResponseSchema('userSchema') },
|
||||
}),
|
||||
rateLimit({
|
||||
windowMs: minutesToMilliseconds(1),
|
||||
max: 20,
|
||||
standardHeaders: true,
|
||||
legacyHeaders: false,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user