moved amount of accesses to more strict handling for api calls

This commit is contained in:
2025-11-07 16:37:43 +01:00
parent 99d5105768
commit e5d836d037

View File

@@ -102,8 +102,8 @@ const getRateLimitConfig = () => {
return { return {
windowMs: parseInt(process.env.RATE_LIMIT_WINDOW_MS || '900000'), // 15 minutes default windowMs: parseInt(process.env.RATE_LIMIT_WINDOW_MS || '900000'), // 15 minutes default
max: isProduction max: isProduction
? parseInt(process.env.RATE_LIMIT_MAX_REQUESTS || '1000') // Stricter in production ? parseInt(process.env.RATE_LIMIT_MAX_REQUESTS || '50') // Stricter in production
: parseInt(process.env.RATE_LIMIT_MAX_REQUESTS || '5000'), // More lenient in development : parseInt(process.env.RATE_LIMIT_MAX_REQUESTS || '100'), // More lenient in development
// Development-specific relaxations // Development-specific relaxations
skip: (req: Request) => { skip: (req: Request) => {
@@ -142,7 +142,7 @@ export const apiLimiter = rateLimit({
// Strict limiter for auth endpoints // Strict limiter for auth endpoints
export const authLimiter = rateLimit({ export const authLimiter = rateLimit({
windowMs: 15 * 60 * 1000, windowMs: 15 * 60 * 1000,
max: parseInt(process.env.AUTH_RATE_LIMIT_MAX_REQUESTS || '100'), max: parseInt(process.env.AUTH_RATE_LIMIT_MAX_REQUESTS || '50'),
message: { message: {
error: 'Zu viele Login-Versuche, bitte versuchen Sie es später erneut' error: 'Zu viele Login-Versuche, bitte versuchen Sie es später erneut'
}, },
@@ -165,7 +165,7 @@ export const authLimiter = rateLimit({
// Separate limiter for expensive endpoints // Separate limiter for expensive endpoints
export const expensiveEndpointLimiter = rateLimit({ export const expensiveEndpointLimiter = rateLimit({
windowMs: 15 * 60 * 1000, windowMs: 15 * 60 * 1000,
max: parseInt(process.env.EXPENSIVE_ENDPOINT_LIMIT || '100'), max: parseInt(process.env.EXPENSIVE_ENDPOINT_LIMIT || '20'),
message: { message: {
error: 'Zu viele Anfragen für diese Ressource' error: 'Zu viele Anfragen für diese Ressource'
}, },