mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-11-30 22:45:46 +01:00
Compare commits
2 Commits
a8dc11b024
...
e5d836d037
| Author | SHA1 | Date | |
|---|---|---|---|
| e5d836d037 | |||
| 99d5105768 |
@@ -68,7 +68,8 @@ const shouldSkipLimit = (req: Request): boolean => {
|
|||||||
const skipPaths = [
|
const skipPaths = [
|
||||||
'/api/health',
|
'/api/health',
|
||||||
'/api/setup/status',
|
'/api/setup/status',
|
||||||
'/api/auth/validate'
|
'/api/auth/validate',
|
||||||
|
'/api/auth/me',
|
||||||
];
|
];
|
||||||
|
|
||||||
// Skip for successful GET requests (data fetching)
|
// Skip for successful GET requests (data fetching)
|
||||||
@@ -101,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) => {
|
||||||
@@ -141,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'
|
||||||
},
|
},
|
||||||
@@ -164,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'
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user