add rate limits to all public endpoints
This commit is contained in:
@@ -10,6 +10,7 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import type { UserProfilesRepository } from '@/models/_.js';
|
||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import ms from 'ms';
|
||||
|
||||
export const meta = {
|
||||
requireCredential: true,
|
||||
@@ -28,6 +29,12 @@ export const meta = {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
max: 10,
|
||||
minInterval: ms('1sec'),
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -10,6 +10,7 @@ import type { UserProfilesRepository, UserSecurityKeysRepository } from '@/model
|
||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { ApiError } from '../../../error.js';
|
||||
import ms from 'ms';
|
||||
|
||||
export const meta = {
|
||||
requireCredential: true,
|
||||
@@ -23,6 +24,12 @@ export const meta = {
|
||||
id: 'f9c54d7f-d4c2-4d3c-9a8g-a70daac86512',
|
||||
},
|
||||
},
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
max: 10,
|
||||
minInterval: ms('1sec'),
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -11,6 +11,7 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { ApiError } from '../../../error.js';
|
||||
import ms from 'ms';
|
||||
|
||||
export const meta = {
|
||||
requireCredential: true,
|
||||
@@ -30,6 +31,12 @@ export const meta = {
|
||||
id: '1fb7cb09-d46a-4fff-b8df-057708cce513',
|
||||
},
|
||||
},
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
max: 10,
|
||||
minInterval: ms('1sec'),
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -49,6 +49,12 @@ export const meta = {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// 2 calls per second
|
||||
limit: {
|
||||
duration: 1000,
|
||||
max: 2,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -48,6 +48,12 @@ export const meta = {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// 2 calls per second
|
||||
limit: {
|
||||
duration: 1000,
|
||||
max: 2,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -13,6 +13,12 @@ export const meta = {
|
||||
requireCredential: true,
|
||||
prohibitMoved: true,
|
||||
kind: 'write:account',
|
||||
|
||||
// 10 calls per 5 seconds
|
||||
limit: {
|
||||
duration: 1000 * 5,
|
||||
max: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -26,6 +26,12 @@ export const meta = {
|
||||
ref: 'NoteFavorite',
|
||||
},
|
||||
},
|
||||
|
||||
// 10 calls per 5 seconds
|
||||
limit: {
|
||||
duration: 1000 * 5,
|
||||
max: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -37,6 +37,12 @@ export const meta = {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// 10 calls per 5 seconds
|
||||
limit: {
|
||||
duration: 1000 * 5,
|
||||
max: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -26,6 +26,12 @@ export const meta = {
|
||||
ref: 'GalleryPost',
|
||||
},
|
||||
},
|
||||
|
||||
// 10 calls per 5 seconds
|
||||
limit: {
|
||||
duration: 1000 * 5,
|
||||
max: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -36,6 +36,12 @@ export const meta = {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// 10 calls per 5 seconds
|
||||
limit: {
|
||||
duration: 1000 * 5,
|
||||
max: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -26,6 +26,12 @@ export const meta = {
|
||||
ref: 'Page',
|
||||
},
|
||||
},
|
||||
|
||||
// 10 calls per 5 seconds
|
||||
limit: {
|
||||
duration: 1000 * 5,
|
||||
max: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -42,6 +42,12 @@ export const meta = {
|
||||
optional: false, nullable: false,
|
||||
ref: 'MeDetailed',
|
||||
},
|
||||
|
||||
// 10 calls per 5 seconds
|
||||
limit: {
|
||||
duration: 1000 * 5,
|
||||
max: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -15,6 +15,12 @@ export const meta = {
|
||||
requireCredential: true,
|
||||
|
||||
kind: 'write:account',
|
||||
|
||||
// 2 calls per second
|
||||
limit: {
|
||||
duration: 1000,
|
||||
max: 2,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -16,6 +16,12 @@ export const meta = {
|
||||
|
||||
errors: {
|
||||
},
|
||||
|
||||
// 10 calls per 5 seconds
|
||||
limit: {
|
||||
duration: 1000 * 5,
|
||||
max: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -14,6 +14,12 @@ export const meta = {
|
||||
res: {
|
||||
type: 'object',
|
||||
},
|
||||
|
||||
// 10 calls per 5 seconds
|
||||
limit: {
|
||||
duration: 1000 * 5,
|
||||
max: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -32,6 +32,12 @@ export const meta = {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// 10 calls per 5 seconds
|
||||
limit: {
|
||||
duration: 1000 * 5,
|
||||
max: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -22,6 +22,12 @@ export const meta = {
|
||||
id: 'ac3ed68a-62f0-422b-a7bc-d5e09e8f6a6a',
|
||||
},
|
||||
},
|
||||
|
||||
// 10 calls per 5 seconds
|
||||
limit: {
|
||||
duration: 1000 * 5,
|
||||
max: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -22,7 +22,13 @@ export const meta = {
|
||||
|
||||
res: {
|
||||
type: 'object',
|
||||
}
|
||||
},
|
||||
|
||||
// 10 calls per 5 seconds
|
||||
limit: {
|
||||
duration: 1000 * 5,
|
||||
max: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -17,6 +17,12 @@ export const meta = {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
|
||||
// 2 calls per second
|
||||
limit: {
|
||||
duration: 1000,
|
||||
max: 2,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -17,6 +17,12 @@ export const meta = {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
|
||||
// 2 calls per second
|
||||
limit: {
|
||||
duration: 1000,
|
||||
max: 2,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -21,6 +21,12 @@ export const meta = {
|
||||
id: '1fac4e8a-a6cd-4e39-a4a5-3a7e11f1b019',
|
||||
},
|
||||
},
|
||||
|
||||
// 2 calls per second
|
||||
limit: {
|
||||
duration: 1000,
|
||||
max: 2,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -31,7 +31,13 @@ export const meta = {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
// 2 calls per second
|
||||
limit: {
|
||||
duration: 1000,
|
||||
max: 2,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -10,6 +10,12 @@ import { RegistryApiService } from '@/core/RegistryApiService.js';
|
||||
export const meta = {
|
||||
requireCredential: true,
|
||||
kind: 'write:account',
|
||||
|
||||
// 2 calls per second
|
||||
limit: {
|
||||
duration: 1000,
|
||||
max: 2,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -12,6 +12,12 @@ export const meta = {
|
||||
requireCredential: true,
|
||||
|
||||
secure: true,
|
||||
|
||||
// 10 calls per 5 seconds
|
||||
limit: {
|
||||
duration: 1000 * 5,
|
||||
max: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -23,6 +23,12 @@ export const meta = {
|
||||
ref: 'Signin',
|
||||
},
|
||||
},
|
||||
|
||||
// 2 calls per second
|
||||
limit: {
|
||||
duration: 1000,
|
||||
max: 2,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -29,6 +29,12 @@ export const meta = {
|
||||
optional: false, nullable: false,
|
||||
ref: 'MeDetailed',
|
||||
},
|
||||
|
||||
// 10 calls per 5 seconds
|
||||
limit: {
|
||||
duration: 1000 * 5,
|
||||
max: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -55,6 +55,12 @@ export const meta = {
|
||||
latestStatus: { type: 'integer', nullable: true },
|
||||
},
|
||||
},
|
||||
|
||||
// 2 calls per second
|
||||
limit: {
|
||||
duration: 1000,
|
||||
max: 2,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -24,6 +24,12 @@ export const meta = {
|
||||
id: 'bae73e5a-5522-4965-ae19-3a8688e71d82',
|
||||
},
|
||||
},
|
||||
|
||||
// 2 calls per second
|
||||
limit: {
|
||||
duration: 1000,
|
||||
max: 2,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -46,6 +46,12 @@ export const meta = {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// 2 calls per second
|
||||
limit: {
|
||||
duration: 1000,
|
||||
max: 2,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -52,6 +52,12 @@ export const meta = {
|
||||
latestStatus: { type: 'integer', nullable: true },
|
||||
},
|
||||
},
|
||||
|
||||
// 10 calls per 5 seconds
|
||||
limit: {
|
||||
duration: 1000 * 5,
|
||||
max: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
@@ -26,6 +26,11 @@ export const meta = {
|
||||
},
|
||||
},
|
||||
|
||||
// 2 calls per second
|
||||
limit: {
|
||||
duration: 1000,
|
||||
max: 2,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
|
||||
Reference in New Issue
Block a user