~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix(security): keep lockout counters an attacker could flush by spraying usernames (#6787)
Lukas1421ee231568
diff --git a/changelog.d/6546.security.md b/changelog.d/6546.security.mdnew file mode 100644index 0000000000..8b990514d5--- /dev/null+++ b/changelog.d/6546.security.md@@ -0,0 +1,8 @@+Flooding failed logins for throwaway usernames can no longer reset an account's lockout counter once it holds two failures, and can no longer release a lockout. Before, eviction deleted every in-progress failure counter whenever the in-memory table filled up. So about 10,000 junk usernames reset a victim's counter, and about 10,000 active lockouts kept any new account from reaching the threshold. Now:++- A failure counter lasts one lockout window from its last failure (15 minutes by default), the same as a lockout. Failures older than that no longer count toward the threshold.+- A counter with two or more failures, and an active lockout, is never evicted before its window ends. The last-resort clear of the whole table is gone.+- Counters holding a single failure are capped at 10,000, and a new one past that evicts the oldest. This is the only eviction.+- Recording a failure no longer scans the table.++What remains: an attacker who makes both the victim's failed logins and a spray of junk usernames can still reset a counter that holds a single failure. That takes 10,000 newer single failures each time, so it yields one password guess per about 10,000 failed logins. Counters with two or more failures, and lockouts, are kept however many there are until their window ends. Each one costs an attacker at least two failed logins within that window.diff --git a/src/local_deep_research/security/account_lockout.py b/src/local_deep_research/security/account_lockout.pyindex 89dcf2e3f6..826ce85ea2 100644--- a/src/local_deep_research/security/account_lockout.py+++ b/src/local_deep_research/security/account_lockout.py@@ -9,6 +9,7 @@ deployments (e.g. gunicorn), each worker maintains separate state."""import threading+from collections import OrderedDictfrom datetime import datetime, timedelta, timezonefrom loguru import logger@@ -17,9 +18,19 @@ from .security_settings import get_security_defaultclass AccountLockoutManager:- """Track failed login attempts and lock accounts after a threshold."""+ """Track failed login attempts and lock accounts after a threshold.- _MAX_STATE_ENTRIES = 10_000+ A failure counter lasts one lockout window from its last failure, the+ same as a lockout. Within its window an entry is kept, with one+ exception that bounds memory: counters holding a single failure, the+ only kind a spray of throwaway usernames creates for one request each,+ are capped at ``_MAX_SINGLE_FAILURES``, and a new one past that evicts+ the oldest. A counter that has reached two failures, and an active+ lockout, stay until their window ends or the user logs in, so flooding+ the table cannot reset them.+ """++ _MAX_SINGLE_FAILURES = 10_000def __init__(self,@@ -38,8 +49,12 @@ class AccountLockoutManager:self.threshold: int = thresholdself.lockout_minutes: int = lockout_minutes- # {username: {"count": int, "locked_until": datetime | None}}- self._state: dict[str, dict] = {}+ # {username: {"count": int, "locked_until": datetime | None,+ # "last_failure": datetime}}, ordered by last failure+ self._state: OrderedDict[str, dict] = OrderedDict()+ # The usernames in _state whose counter holds a single failure and+ # no lockout, in the order of that failure.+ self._singles: OrderedDict[str, None] = OrderedDict()self._lock = threading.Lock()# ------------------------------------------------------------------@@ -62,40 +77,40 @@ class AccountLockoutManager:return Falsereturn True- def _evict(self) -> None:- """Remove expired/unlocked entries to reclaim memory.+ def _drop_expired(self, now: datetime) -> None:+ """Drop the entries whose last failure is a full window old.++ The table is ordered by last failure, so they are all at its front.+ A lockout ends one window after the failure that set it, so this+ covers expired lockouts as well as counters whose window has passed.Must be called while ``self._lock`` is held."""- now = datetime.now(timezone.utc)- expired_keys = [- key- for key, entry in self._state.items()- if entry.get("locked_until") is None or entry["locked_until"] <= now- ]- for key in expired_keys:- del self._state[key]-- logger.info(- "Evicted {} expired/unlocked lockout entries", len(expired_keys)- )-- # Last resort: if still over limit, blanket clear- if len(self._state) > self._MAX_STATE_ENTRIES:- self._state.clear()- logger.info("Blanket-cleared lockout state (still over limit)")+ cutoff = now - timedelta(minutes=self.lockout_minutes)+ while self._state:+ username, entry = next(iter(self._state.items()))+ if entry["last_failure"] > cutoff:+ break+ del self._state[username]+ self._singles.pop(username, None)def record_failure(self, username: str) -> None:"""Record a failed login attempt for *username*."""with self._lock:- if len(self._state) > self._MAX_STATE_ENTRIES:- self._evict()- entry = self._state.setdefault(- username, {"count": 0, "locked_until": None}- )+ # Read under the lock, so the table's order by last failure is+ # the order in which failures take the lock.+ now = datetime.now(timezone.utc)+ self._drop_expired(now)+ entry = self._state.get(username)+ if entry is None:+ entry = {"count": 0, "locked_until": None}+ self._state[username] = entry+ else:+ self._state.move_to_end(username)+ entry["last_failure"] = nowentry["count"] += 1if entry["count"] >= self.threshold:- entry["locked_until"] = datetime.now(timezone.utc) + timedelta(+ entry["locked_until"] = now + timedelta(minutes=self.lockout_minutes)logger.warning(@@ -103,10 +118,19 @@ class AccountLockoutManager:self.threshold,)+ if entry["count"] == 1 and entry["locked_until"] is None:+ self._singles[username] = None+ if len(self._singles) > self._MAX_SINGLE_FAILURES:+ oldest, _ = self._singles.popitem(last=False)+ del self._state[oldest]+ else:+ self._singles.pop(username, None)+def record_success(self, username: str) -> None:"""Clear the failure counter for *username* after a successful login."""with self._lock:removed = self._state.pop(username, None)+ self._singles.pop(username, None)if removed is not None:logger.info("Account lockout cleared after successful login")diff --git a/tests/security/test_account_lockout.py b/tests/security/test_account_lockout.pyindex 567bf64d41..549959f70e 100644--- a/tests/security/test_account_lockout.py+++ b/tests/security/test_account_lockout.py@@ -87,58 +87,106 @@ class TestAccountLockout:mock_dt.now.return_value = now + timedelta(minutes=15)assert mgr.is_locked("alice") is False- def test_eviction_removes_unlocked_entries(self):- """Eviction should remove unlocked/expired entries, not blanket clear."""+ def test_a_single_failure_past_the_cap_evicts_the_oldest_one(self):+ """Single-failure counters are the only ones a spray of throwaway+ usernames creates for one request each; they are capped, oldest+ out first."""mgr = self._make_manager(threshold=5)- mgr._MAX_STATE_ENTRIES = 100- now = datetime.now(timezone.utc)-- # Add unlocked entries (count < threshold, no locked_until)- for i in range(90):- mgr._state[f"unlocked_{i}"] = {"count": 1, "locked_until": None}-- # Add expired locked entries- for i in range(10):- mgr._state[f"expired_{i}"] = {- "count": 5,- "locked_until": now - timedelta(minutes=1),- }-- # Add actively locked entries- for i in range(5):- mgr._state[f"locked_{i}"] = {- "count": 5,- "locked_until": now + timedelta(minutes=10),- }-- assert len(mgr._state) == 105-- # Trigger eviction via record_failure- mgr.record_failure("attacker")-- # Actively locked entries should survive- for i in range(5):- assert f"locked_{i}" in mgr._state- # New entry should exist- assert "attacker" in mgr._state- # Unlocked/expired entries should be gone- assert not any(k.startswith("unlocked_") for k in mgr._state)- assert not any(k.startswith("expired_") for k in mgr._state)-- def test_blanket_clear_as_last_resort(self):- """If eviction can't reduce below limit, blanket clear."""+ mgr._MAX_SINGLE_FAILURES = 5+ for i in range(6):+ mgr.record_failure(f"u{i}")++ assert list(mgr._state) == [f"u{i}" for i in range(1, 6)]++ def test_a_counter_with_two_failures_is_never_evicted(self):+ mgr = self._make_manager(threshold=5)+ mgr._MAX_SINGLE_FAILURES = 5+ for _ in range(2):+ mgr.record_failure("victim")+ for i in range(100):+ mgr.record_failure(f"spray{i}")++ assert mgr._state["victim"]["count"] == 2+ assert len(mgr._state) == 6++ def test_active_lockouts_are_never_evicted(self):+ """There is no last-resort clear: a table full of lockouts keeps+ every one of them, and a new username is still tracked."""mgr = self._make_manager(threshold=3)- mgr._MAX_STATE_ENTRIES = 10- now = datetime.now(timezone.utc)-- # Fill with actively locked entries (can't be evicted)- for i in range(15):- mgr._state[f"locked_{i}"] = {- "count": 5,- "locked_until": now + timedelta(hours=1),- }-- mgr.record_failure("attacker")- # Should have blanket-cleared then added new entry- assert len(mgr._state) == 1- assert "attacker" in mgr._state+ mgr._MAX_SINGLE_FAILURES = 5+ for i in range(50):+ for _ in range(3):+ mgr.record_failure(f"locked{i}")+ for i in range(100):+ mgr.record_failure(f"spray{i}")+ for _ in range(3):+ mgr.record_failure("late")++ assert all(mgr.is_locked(f"locked{i}") for i in range(50))+ assert mgr.is_locked("late") is True++ def test_a_one_failure_lockout_is_not_evicted_as_a_single(self):+ """With a threshold of one, the first failure is already a lockout,+ and lockouts are never evicted."""+ mgr = self._make_manager(threshold=1)+ mgr._MAX_SINGLE_FAILURES = 5+ mgr.record_failure("victim")+ for i in range(20):+ mgr.record_failure(f"spray{i}")++ assert mgr.is_locked("victim") is True++ def test_a_login_clears_the_single_failure_record_too(self):+ mgr = self._make_manager(threshold=5)+ mgr._MAX_SINGLE_FAILURES = 5+ mgr.record_failure("alice")+ mgr.record_success("alice")+ for i in range(20):+ mgr.record_failure(f"spray{i}")++ assert len(mgr._state) == 5++ def test_an_old_counter_behind_a_recent_one_still_expires(self):+ """A failure moves its counter to the recent end of the table, so+ the expired counters are the ones at its front."""+ mgr = self._make_manager(threshold=5, lockout_minutes=15)+ now = datetime(2026, 1, 1, 12, 0, 0, tzinfo=timezone.utc)+ with patch(+ "local_deep_research.security.account_lockout.datetime"+ ) as mock_dt:+ for minute, username in ((0, "alice"), (1, "bob"), (10, "alice")):+ mock_dt.now.return_value = now + timedelta(minutes=minute)+ mgr.record_failure(username)+ mock_dt.now.return_value = now + timedelta(minutes=16)+ mgr.record_failure("bob")++ assert mgr._state["bob"]["count"] == 1+ assert mgr._state["alice"]["count"] == 2++ def test_a_counter_forgets_failures_older_than_the_window(self):+ """A counter lasts one lockout window from its last failure, the+ same as a lockout, so failures an attacker banked earlier stop+ counting."""+ mgr = self._make_manager(threshold=3, lockout_minutes=15)+ now = datetime(2026, 1, 1, 12, 0, 0, tzinfo=timezone.utc)+ with patch(+ "local_deep_research.security.account_lockout.datetime"+ ) as mock_dt:+ mock_dt.now.return_value = now+ for _ in range(2):+ mgr.record_failure("alice")+ mock_dt.now.return_value = now + timedelta(minutes=15)+ mgr.record_failure("alice")+ assert mgr.is_locked("alice") is False+ assert mgr._state["alice"]["count"] == 1++ def test_failures_inside_the_window_keep_counting(self):+ mgr = self._make_manager(threshold=3, lockout_minutes=15)+ now = datetime(2026, 1, 1, 12, 0, 0, tzinfo=timezone.utc)+ with patch(+ "local_deep_research.security.account_lockout.datetime"+ ) as mock_dt:+ for minute in (0, 14, 28):+ mock_dt.now.return_value = now + timedelta(minutes=minute)+ mgr.record_failure("alice")+ assert mgr.is_locked("alice") is Truediff --git a/tests/security/test_guard_internals.py b/tests/security/test_guard_internals.pyindex a2ef127ede..82f9e4abef 100644--- a/tests/security/test_guard_internals.py+++ b/tests/security/test_guard_internals.py@@ -9,7 +9,7 @@ guards. This file tests the guards' own decision logic:bypass corpus, and does the trusted-domain allowlist ever fail open?* ``log_sanitizer.sanitize_error_message`` — which credential *shapes*does it not match?-* ``account_lockout`` — is the ``_MAX_STATE_ENTRIES`` eviction reachable+* ``account_lockout`` — is the ``_MAX_SINGLE_FAILURES`` eviction reachablefrom the public API, and what does an attacker get by reaching it?* fail-open vs fail-closed — when a guard's own dependency raises, doesit deny or allow?@@ -28,6 +28,7 @@ red, which is the intended signal.import ipaddressimport osimport tempfile+import timefrom datetime import datetime, timedelta, timezonefrom pathlib import Path@@ -552,53 +553,63 @@ def _lock_out(mgr, username):def _saturate(mgr):- """Drive the state table over ``_MAX_STATE_ENTRIES`` using only the+ """Lock out more usernames than ``_MAX_SINGLE_FAILURES`` using only thepublic API -- ``record_failure`` and nothing else.~100k calls with the real constant; measured at ~0.1s, so this is areachability proof rather than a stress test."""- for i in range(mgr._MAX_STATE_ENTRIES + 1):+ for i in range(mgr._MAX_SINGLE_FAILURES + 1):_lock_out(mgr, f"spray-{i}")+def _ballast(mgr, usernames, failures):+ """Raise each of *usernames* to *failures* failed attempts."""+ for username in usernames:+ for _ in range(failures):+ mgr.record_failure(username)+++def _spray(mgr, prefix, count):+ """One failed attempt each for *count* new usernames."""+ for i in range(count):+ mgr.record_failure(f"{prefix}-{i}")+++def _count(mgr, username):+ """The failures *username* has on record, 0 once evicted."""+ entry = mgr._state.get(username)+ return 0 if entry is None else entry["count"]++class TestLockoutStateEviction:- """``_MAX_STATE_ENTRIES`` eviction, reached only via the public API.+ """``_MAX_SINGLE_FAILURES`` eviction, reached only via the public API.- The existing suite reaches eviction by writing ``mgr._state``- directly and by shrinking ``_MAX_STATE_ENTRIES`` to 10 or 100. That- proves the mechanism but not that an attacker can reach it, and it- never asserts what the attacker *gets*. These tests use the real- constant and only ``record_failure`` / ``is_locked``.+ The unit suite shrinks ``_MAX_SINGLE_FAILURES`` to prove the mechanism.+ These tests use the real constants and only ``record_failure`` /+ ``is_locked``, and assert what an attacker *gets*."""def test_the_eviction_threshold_is_reachable_by_spraying(self):- """~10k requests with distinct usernames fills the table."""+ """~10k requests with distinct usernames fills the single-failure+ pool; the next one evicts the oldest."""mgr = _make_manager()- for i in range(mgr._MAX_STATE_ENTRIES + 1):+ for i in range(mgr._MAX_SINGLE_FAILURES + 1):mgr.record_failure(f"spray-{i}")- assert len(mgr._state) == mgr._MAX_STATE_ENTRIES + 1+ assert len(mgr._state) == mgr._MAX_SINGLE_FAILURES+ assert "spray-0" not in mgr._state- @pytest.mark.xfail(- strict=True,- reason=(- "DEFECT (security): _evict() deletes every entry whose "- "locked_until is None -- i.e. every partially-accumulated "- "failure counter. An attacker sitting at threshold-1 against "- "a victim sprays ~10k junk usernames, the next "- "record_failure triggers eviction, and the victim's counter "- "is reset to zero. The lockout can therefore never be "- "reached by an attacker willing to pay ~10k cheap requests "- "per (threshold-1) guesses."- ),- )def test_spraying_does_not_reset_a_victims_partial_counter(self):+ """Eviction used to delete every partial failure counter, so ~10k+ junk usernames reset a victim sitting at threshold-1 (#6546). The+ fewest-failure counters now go first, which here are the junk ones.+ """mgr = _make_manager()victim = "victim"for _ in range(mgr.threshold - 1):mgr.record_failure(victim)- for i in range(mgr._MAX_STATE_ENTRIES + 1):+ for i in range(mgr._MAX_SINGLE_FAILURES + 1):mgr.record_failure(f"spray-{i}")# One more failure should be the one that locks the account.@@ -606,21 +617,14 @@ class TestLockoutStateEviction:assert mgr.is_locked(victim) is Truedef test_a_saturating_spray_cannot_release_an_active_lockout(self):- """The blanket clear does not fire, so live lockouts survive.-- ``_evict``'s last-resort ``self._state.clear()`` would drop- ACTIVE lockouts. It turns out to be unreachable from the public- API: at the moment eviction runs there is always exactly one- partially-counted entry (the username whose own- ``record_failure`` is in flight), removing it gets back under- the limit, and the clear is skipped. The existing- ``test_account_lockout.py::test_blanket_clear_as_last_resort``- reaches that branch only by writing ``_state`` directly.-- Recorded as a positive result: an attacker cannot buy a victim's- release this way. It is load-bearing for the defect below --- the same "always one evictable partial entry" property is- exactly what makes new lockouts impossible.+ """Live lockouts survive a saturating spray.++ Eviction never removes an active lockout, and there is no+ last-resort clear, so ~10k locked junk usernames leave the victim+ locked: an attacker cannot buy a victim's release this way. Every+ spray account is locked too, because a counter still climbing is+ no longer evicted from under its own failures (see the test+ below)."""mgr = _make_manager()victim = "victim"@@ -630,32 +634,18 @@ class TestLockoutStateEviction:_saturate(mgr)assert mgr.is_locked(victim) is True- assert len(mgr._state) == mgr._MAX_STATE_ENTRIES + 1+ assert len(mgr._state) == mgr._MAX_SINGLE_FAILURES + 2+ assert all(mgr.is_locked(f"spray-{i}") for i in (0, 9_999, 10_000))- @pytest.mark.xfail(- strict=True,- reason=(- "DEFECT (security): once the table is saturated with "- "_MAX_STATE_ENTRIES+1 locked entries, NO account that is not "- "already in it can ever be locked out again. Every "- "record_failure for such a username first runs _evict(), "- "which deletes every entry whose locked_until is None -- "- "including that username's own partial counter -- and "- "setdefault then recreates it at count=1. The counter can "- "never climb to the threshold: 200 consecutive failures "- "leave {'count': 1, 'locked_until': None}. Account lockout "- "is switched OFF for every new username for as long as the "- "table stays saturated. Cost to an attacker: ~100k failed "- "logins to saturate (10k usernames x threshold), refreshed "- "every lockout_minutes (default 15) because expired entries "- "are what eviction reclaims; after that, unlimited password "- "guessing against any target with no lockout at all. The "- "memory-bound intended to protect the guard disables it."- ),- )def test_a_new_account_can_still_be_locked_when_the_table_is_full(self,):+ """Once the table was saturated with locked entries, eviction+ deleted a new username's own partial counter on each of its+ failures, so it never climbed past 1 and lockout was off for every+ new account (#6546). The counter being recorded is now never+ evicted.+ """mgr = _make_manager()_saturate(mgr)@@ -665,6 +655,87 @@ class TestLockoutStateEviction:assert mgr.is_locked(late_victim) is True+ def test_a_ballast_above_the_victims_count_cannot_evict_it(self):+ """Ballast reset (review of #6787): 9,000 junk usernames at nine+ failures each outranked a victim at two, so every 1,001-name spray+ evicted the victim. A counter that has reached two failures is+ never evicted."""+ mgr = _make_manager()+ _ballast(mgr, [f"ballast-{i}" for i in range(9_000)], 9)+ for _ in range(2):+ mgr.record_failure("victim")+ for cycle in range(3):+ _spray(mgr, f"spray{cycle}", 1_001)+ assert _count(mgr, "victim") == 2++ for _ in range(mgr.threshold - 2):+ mgr.record_failure("victim")+ assert mgr.is_locked("victim") is True++ def test_an_equal_count_spray_cannot_evict_the_victim(self):+ """Junk raised to the victim's count after the victim's last+ failure made the victim the least recent of its equals, which is+ the entry eviction took first."""+ mgr = _make_manager()+ for _ in range(3):+ mgr.record_failure("victim")+ _ballast(mgr, [f"equal-{i}" for i in range(9_001)], 3)+ _spray(mgr, "spray", 1_001)++ assert _count(mgr, "victim") == 3++ def test_a_victim_one_failure_short_survives_locked_ballast(self):+ """Behind 9,001 locked entries, a 1,001-name spray evicted a+ victim at threshold - 1."""+ mgr = _make_manager()+ for i in range(9_001):+ _lock_out(mgr, f"locked-{i}")+ for _ in range(mgr.threshold - 1):+ mgr.record_failure("victim")+ _spray(mgr, "spray", 1_001)++ mgr.record_failure("victim")+ assert mgr.is_locked("victim") is True++ def test_a_counter_climbing_between_sprays_reaches_the_lockout(self):+ """Mid-climb eviction: with ballast present, a spray between each+ of an account's failures evicted its counter every time, so nine+ of ten failures got through without a lockout."""+ mgr = _make_manager()+ _ballast(mgr, [f"ballast-{i}" for i in range(9_000)], 9)+ for cycle in range(mgr.threshold):+ mgr.record_failure("victim")+ _spray(mgr, f"spray{cycle}", 1_001)++ assert mgr.is_locked("victim") is True++ def test_a_single_failure_is_evicted_only_behind_the_whole_pool(self):+ """What is left: a counter that holds a single failure can be+ reset, but only by ``_MAX_SINGLE_FAILURES`` newer single failures,+ so an attacker who also makes the victim's failures gets one guess+ per ~10,000 failed logins."""+ mgr = _make_manager()+ _spray(mgr, "before", mgr._MAX_SINGLE_FAILURES)+ mgr.record_failure("victim")++ _spray(mgr, "after", mgr._MAX_SINGLE_FAILURES - 1)+ assert "victim" in mgr._state+ _spray(mgr, "last", 1)+ assert "victim" not in mgr._state++ def test_recording_a_failure_does_not_scan_the_table(self):+ """Each failure is constant work: with 100,000 entries, a+ full-table scan per failure took ~6 ms, so 1,000 failures took+ seconds."""+ mgr = _make_manager()+ _ballast(mgr, [f"ballast-{i}" for i in range(90_000)], 2)+ _spray(mgr, "fill", mgr._MAX_SINGLE_FAILURES)+ assert len(mgr._state) == 100_000++ started = time.perf_counter()+ _spray(mgr, "timed", 1_000)+ assert time.perf_counter() - started < 1.0+def test_eviction_is_a_noop_while_the_table_is_small(self):"""Positive control: ordinary traffic never triggers eviction."""mgr = _make_manager()@@ -673,6 +744,49 @@ class TestLockoutStateEviction:mgr.record_failure(f"noise-{i}")assert mgr.is_locked("victim") is True+ def test_a_failure_waiting_for_the_lock_is_stamped_after_its_holder(+ self, monkeypatch+ ):+ """Expiry scans the table from the front, so the table has to stay+ ordered by last failure. The first failure is held inside its clock+ read while a second one arrives: a clock read before taking the lock+ let the second one append first, with the later time."""+ import threading++ from local_deep_research.security import account_lockout++ start = datetime(2026, 1, 1, tzinfo=timezone.utc)+ reading = threading.Event()+ release = threading.Event()++ class HeldClock:+ @staticmethod+ def now(tz=None):+ if threading.current_thread().name == "first":+ reading.set()+ release.wait(5)+ return start+ return start + timedelta(seconds=1)++ monkeypatch.setattr(account_lockout, "datetime", HeldClock)+ mgr = _make_manager()+ first = threading.Thread(+ target=mgr.record_failure, args=("first-user",), name="first"+ )+ second = threading.Thread(+ target=mgr.record_failure, args=("second-user",), name="second"+ )+ first.start()+ assert reading.wait(5)+ second.start()+ second.join(0.2)+ release.set()+ first.join(5)+ second.join(5)++ stamps = [entry["last_failure"] for entry in mgr._state.values()]+ assert stamps == sorted(stamps)+class TestLockoutScope:"""Lockout is keyed on username and nothing else."""diff --git a/tests/web/auth/test_auth_coverage.py b/tests/web/auth/test_auth_coverage.pyindex 06cf5f2558..0526c32ef1 100644--- a/tests/web/auth/test_auth_coverage.py+++ b/tests/web/auth/test_auth_coverage.py@@ -172,8 +172,7 @@ class TestAccountLockoutManager:entry["locked_until"] = datetime.datetime.now(timezone.utc) - timedelta(seconds=10)- # Trigger eviction by exceeding _MAX_STATE_ENTRIES- mgr._MAX_STATE_ENTRIES = 50 # lower threshold for test+ # The next failure drops the expired entriesmgr.record_failure("trigger_evict")# After eviction, expired entries should be gonewith mgr._lock: