From 6ba5e1b10b2fb1958d592c609f13c698708745d3 Mon Sep 17 00:00:00 2001 From: Timo <6156589+Shik3i@users.noreply.github.com> Date: Sat, 13 Jun 2026 04:38:22 +0200 Subject: [PATCH] Increase failedAuthAttempts eviction limit from 50k to 200k --- server/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/index.js b/server/index.js index 38720f0..4c1650c 100644 --- a/server/index.js +++ b/server/index.js @@ -148,22 +148,22 @@ function checkAuthRate(ip, roomId) { } function recordAuthFailure(ip, roomId) { - if (failedAuthAttempts.size > 50000) { + if (failedAuthAttempts.size > 200000) { const now = Date.now(); // 1. Clear expired entries (> 15 mins) for (const [key, record] of failedAuthAttempts.entries()) { if (now - record.lastAttempt > 15 * 60 * 1000) { failedAuthAttempts.delete(key); } else { - break; // Since entries are insertion-ordered by time, all subsequent entries are newer + break; } } - // 2. If still over 50k, perform LRU-style eviction on the oldest 10,000 entries (first items in Map order) - if (failedAuthAttempts.size > 50000) { - log('SECURITY', 'failedAuthAttempts size exceeded 50000. Performing insertion-order eviction.'); + // 2. If still over 200k, perform LRU-style eviction on the oldest 10,000 entries (first items in Map order) + if (failedAuthAttempts.size > 200000) { + log('SECURITY', 'failedAuthAttempts size exceeded 200000. Performing insertion-order eviction.'); for (const [key] of failedAuthAttempts.entries()) { - if (failedAuthAttempts.size <= 40000) { + if (failedAuthAttempts.size <= 190000) { break; } failedAuthAttempts.delete(key);