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
@@ -77,11 +77,12 @@ LOGIN_LOCAL_KEYS_MAX = 100_000
# предел размера тела запроса вне загрузки вложения (change auth-hardening,
# design, решение 8): больше наибольшего валидного тела контракта (~48,4
# KB — сообщение из 4000 экранированных пар и 10 вложений). То же число — в
# infra/haproxy/haproxy.cfg (frontend entry)
# KB — сообщение из 4000 экранированных пар и 10 вложений). Отклоняет только
# реплика (middlewares/body_limit.py): в LB предела нет — решение пользователя
# 2026-11-18
REQUEST_BODY_MAX_BYTES = 65536
# путь загрузки вложения: на нём свой предел (10 MiB, сервис); то же
# выражение — у set-timeout и предела тела в haproxy.cfg
# выражение — у set-timeout в haproxy.cfg
UPLOAD_PATH_PATTERN = r"^/api/v1/chats/[^/]+/attachments$"
# сессия