Skip to content

Commit 23bcf0b

Browse files
committed
feat: update authentication rate limiting to 15-minute windows
Updated all authentication rate limiters from 1-hour windows to more reasonable 15-minute windows for better user experience while maintaining security. Also fixed TypeScript error in PasswordRequirements component. Changes: - Auth rate limiter: 5 requests per 15 minutes (was 1 hour) - Strict auth rate limiter: 3 requests per 15 minutes (unchanged window) - Signup rate limiter: 5 attempts per 15 minutes (was 1 hour) - Fixed useEffect return type in PasswordRequirements.tsx
1 parent 3e94214 commit 23bcf0b

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

packages/server/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,8 @@ async function startServer() {
556556

557557
// Rate limiting configuration for authentication endpoints
558558
const authRateLimiter = rateLimit({
559-
windowMs: 60 * 60 * 1000, // 1 hour
560-
max: 5, // Max 5 requests per hour per IP
559+
windowMs: 15 * 60 * 1000, // 15 minutes
560+
max: 5, // Max 5 requests per 15 minutes per IP
561561
standardHeaders: true,
562562
legacyHeaders: false,
563563
skipSuccessfulRequests: false,

packages/server/src/resolvers/sqlite-auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const signupRateLimits = new Map<string, RateLimitEntry>();
3030

3131
function checkSignupRateLimit(ip: string): { allowed: boolean; retryAfter?: number } {
3232
const now = Date.now();
33-
const windowMs = 60 * 60 * 1000;
33+
const windowMs = 15 * 60 * 1000;
3434
const maxAttempts = 5;
3535

3636
const entry = signupRateLimits.get(ip);

packages/web/src/components/PasswordRequirements.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export function PasswordRequirements({ password, showAll = false }: PasswordRequ
5151
} else if (password) {
5252
setShowBox(true);
5353
}
54+
return undefined;
5455
}, [allRequiredMet, password]);
5556

5657
if (!password) return null;

0 commit comments

Comments
 (0)