fix: address auth subsystem issues from ws-debug review

- lib/auth: make RateLimiter.is_allowed read-only (no dict mutation on read)
- daemon/server: add periodic blacklist_expired cleanup to poll loop (60s interval)
- daemon/server: negotiate only matched Bearer subprotocol on WebSocket connect
- webui/server: rewrite _is_personal_auth with path-prefix matching, cover WebAuthn register routes
- daemon/handlers/auth: eliminate redundant get_user call in auth_update_user
This commit is contained in:
2026-08-12 17:51:09 +00:00
parent 0889ef0d08
commit 85d8770ba6
4 changed files with 42 additions and 23 deletions
+2 -5
View File
@@ -379,11 +379,8 @@ class RateLimiter:
now = time.time()
cutoff = now - self.window
timestamps = self.failures.get(key, [])
# Clean old entries
self.failures[key] = [t for t in timestamps if t > cutoff]
return len(self.failures[key]) < self.max_attempts
clean = [t for t in timestamps if t > cutoff]
return len(clean) < self.max_attempts
def record_failure(self, key: str) -> None:
"""Record a failed attempt for *key*."""