1
0
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:
Jaanus Sellin 2023-04-06 14:45:54 +03:00 committed by GitHub
parent d33f11511a
commit 14a2ca700c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,
}),
],
});