feat: harden authentication (Argon2id by measurement, login limits, body limit)

Apply auth-hardening up to the bench_login label: Argon2id parameters
from [auth] chosen by driver.py argon2-params (m=64 MiB, t=2, p=1),
rehash on login, per-process KDF budget with 429, shared login failure
limit in Valkey with a local fallback, X-Forwarded-For from HAProxy,
64 KiB body limit (400) in LB and middleware, bench login profile,
tests, threat model and trust matrix rows. Hypotheses H1-H4 are
committed here before the baseline label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 17:52:48 +03:00
co-authored by Claude Opus 5.5
parent 5573973670
commit 13fdd187c6
57 changed files with 4184 additions and 175 deletions
+7
View File
@@ -127,6 +127,13 @@ identity `ingress` (change `https-tooling`, design, решение 4).
- Консоль (`make run_dev`, `driver.py start`) — HTTPS на `127.0.0.1:APP__PORT` с identity
`ingress` без проверки клиента (`API_TLS__CLIENT_AUTH=false`): публичный smoke лабы 7 HTTP не
принимает, а клиентского сертификата у него нет.
- Доверие заголовку адреса клиента (change `auth-hardening`, design, решение 6): реплика в
docker с `client_auth = true` берёт адрес клиента для предела входа только из
`X-Forwarded-For` — каждое её соединение прошло allowlist identity `haproxy`, а LB
перезаписывает значение клиента (`balancer.md`). Доверия по IP LB (`forwarded_allow_ips`)
нет: адрес LB в сети compose динамический, identity уже проверена. В консоли (без проверки
клиента) заголовок не учитывается, `uvicorn.run(proxy_headers=False)`; правило — одна функция
`client_address` в `dependencies.py` (`api-layer.md`).
## Health