Skip to content

~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.

docs(security): state the clock-step assumption in account_lockout's under-lock read (#6956)

LearningCircuit918e086efba5
diff --git a/src/local_deep_research/security/account_lockout.py b/src/local_deep_research/security/account_lockout.py
index 826ce85ea2..a3e8bb2edd 100644
--- a/src/local_deep_research/security/account_lockout.py
+++ b/src/local_deep_research/security/account_lockout.py
@@ -98,7 +98,19 @@ class AccountLockoutManager:
"""Record a failed login attempt for *username*."""
with self._lock:
# Read under the lock, so the table's order by last failure is
- # the order in which failures take the lock.
+ # the order in which failures take the lock — assuming the
+ # wall clock doesn't step backwards (#6943). A backward step
+ # of d (NTP correction, manual clock change) can leave an older
+ # stamp after a newer one. _drop_expired stops at the first
+ # unexpired entry, so an expired counter behind it can linger
+ # up to d past its window; repeated steps add up, and nothing
+ # caps the linger at the lockout window. While it lingers, its
+ # count carries into that user's next failure. The direction
+ # is conservative: a backward step drops nothing early, and
+ # is_locked compares locked_until with the clock directly, so
+ # no lockout ends early (one set before the step lasts up to d
+ # longer). If that ever needs hardening, clamp stamps
+ # (max(latest_seen, now)) or order on a monotonic clock instead.
now = datetime.now(timezone.utc)
self._drop_expired(now)
entry = self._state.get(username)