fix: address auth-hardening verify findings

Drop the body-limit rule from HAProxy (user decision 2026-11-18): the
replica middleware answers 400 with X-Instance-Id, tests require the
header again. Widen the failure_checks selection in the trust matrix,
name 13fdd18 in the evidence header, document Valkey LRU eviction of
login counters and the allowlist as trusted X-Forwarded-For senders,
check waited_ms of KDF budget rejections in the queue scenario.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 10:31:57 +03:00
co-authored by Claude Opus 5.5
parent 4d117f0297
commit 3f4771c9d9
22 changed files with 372 additions and 127 deletions
+4 -3
View File
@@ -518,9 +518,10 @@ def test_declared_body_over_limit(
content=body,
headers=headers,
)
# через LB отказывает LB: X-Instance-Id у его ответа нет
# отказывает реплика по Content-Length, не читая тело (решение
# пользователя 2026-11-18: предела в LB нет), — с X-Instance-Id
for resp in (with_auth, without_auth):
error = assert_error(resp, 400, instance_id=False)
error = assert_error(resp, 400)
assert error["message"] == "Request body is too large"
assert api.all_messages(alice, chat["id"]) == []
@@ -537,7 +538,7 @@ def test_chunked_body_over_limit(
content=_chunks(BODY_MAX_BYTES + 8192),
headers={"Content-Type": "application/json"},
)
# Content-Length нет — LB тело не меряет, отказывает реплика
# Content-Length нет — реплика меряет тело счётчиком
error = assert_error(resp, 400)
assert error["message"] == "Request body is too large"
assert_instance_id(resp)