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
+3 -2
View File
@@ -119,8 +119,9 @@ FastAPI, один процесс на реплику; реплик ≥2 за HAP
- Предел размера тела (change `auth-hardening`, design, решение 8) —
`BodySizeLimitMiddleware` (`middlewares/body_limit.py`), чистое ASGI внутри
`RequestContextMiddleware` (добавляется раньше него): у 400 есть
`X-Request-Id`, `X-Instance-Id` и итоговая запись. Кроме `POST` пути загрузки
(`UPLOAD_PATH_PATTERN`, то же выражение — в `haproxy.cfg`):
`X-Request-Id`, `X-Instance-Id` и итоговая запись; единственное место предела — в LB его нет
(решение пользователя 2026-11-18). Кроме `POST` пути загрузки
(`UPLOAD_PATH_PATTERN`, то же выражение — у `set-timeout` в `haproxy.cfg`):
`Content-Length` > `REQUEST_BODY_MAX_BYTES` — 400 до приложения; без него —
счётчик в обёртке `receive`, превышение — приложению `http.disconnect`, его
ответ заменяется 400 «Request body is too large», остаток не читается; уже