Skip to content
Snippets Groups Projects
Commit 20474492 authored by syuilo's avatar syuilo
Browse files

enhance(server): add rate limits for some endpoints

parent e46e7f52
No related branches found
No related tags found
No related merge requests found
import { Inject, Injectable } from '@nestjs/common';
import ms from 'ms';
import { Endpoint } from '@/server/api/endpoint-base.js';
import type { DriveFoldersRepository } from '@/models/index.js';
import { IdService } from '@/core/IdService.js';
......@@ -14,6 +15,11 @@ export const meta = {
kind: 'write:drive',
limit: {
duration: ms('1hour'),
max: 10,
},
errors: {
noSuchFolder: {
message: 'No such folder.',
......
......@@ -6,15 +6,15 @@ import { IdentifiableError } from '@/misc/identifiable-error.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { UserFollowingService } from '@/core/UserFollowingService.js';
import { DI } from '@/di-symbols.js';
import { ApiError } from '../../error.js';
import { GetterService } from '@/server/api/GetterService.js';
import { ApiError } from '../../error.js';
export const meta = {
tags: ['following', 'users'],
limit: {
duration: ms('1hour'),
max: 100,
max: 50,
},
requireCredential: true,
......
......@@ -18,7 +18,7 @@ export const meta = {
limit: {
duration: ms('1hour'),
max: 300,
max: 20,
},
res: {
......
import { Inject, Injectable } from '@nestjs/common';
import ms from 'ms';
import { Endpoint } from '@/server/api/endpoint-base.js';
import type { BlockingsRepository, UserGroupJoiningsRepository, DriveFilesRepository, UserGroupsRepository } from '@/models/index.js';
import type { User } from '@/models/entities/User.js';
......@@ -15,6 +16,11 @@ export const meta = {
kind: 'write:messaging',
limit: {
duration: ms('1hour'),
max: 120,
},
res: {
type: 'object',
optional: false, nullable: false,
......
import { Inject, Injectable } from '@nestjs/common';
import ms from 'ms';
import type { NotesRepository, NoteThreadMutingsRepository } from '@/models/index.js';
import { IdService } from '@/core/IdService.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
......@@ -14,6 +15,11 @@ export const meta = {
kind: 'write:account',
limit: {
duration: ms('1hour'),
max: 10,
},
errors: {
noSuchNote: {
message: 'No such note.',
......
......@@ -17,7 +17,7 @@ export const meta = {
limit: {
duration: ms('1hour'),
max: 300,
max: 10,
},
res: {
......
import { Inject, Injectable } from '@nestjs/common';
import ms from 'ms';
import type { UserGroupsRepository, UserGroupJoiningsRepository } from '@/models/index.js';
import { IdService } from '@/core/IdService.js';
import type { UserGroup } from '@/models/entities/UserGroup.js';
......@@ -16,6 +17,11 @@ export const meta = {
description: 'Create a new group.',
limit: {
duration: ms('1hour'),
max: 10,
},
res: {
type: 'object',
optional: false, nullable: false,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment