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
+15
View File
@@ -99,6 +99,21 @@ paths:
TLS 1.3 с EC — доли миллисекунды (`make test-failover`,
`evidence/security/https-hooks.md`). Отрицательные проверки — `make
mtls_check` (`tls.md`).
- С change `auth-hardening` (design, решения 6, 8) в `frontend entry` две
строки:
- `http-request set-header X-Forwarded-For %[src]` — значение клиента
перезаписывается адресом соединения (а не `option forwardfor`, который
дописывает): у реплики ровно один адрес, она верит ему только от
identity `haproxy` (`tls.md`); до пересоздания `haproxy` (`make
run_docker`) реплики считают адресом LB — предел адреса общий для всех;
- `http-request return status 400 … if { req.hdr_val(content-length) gt
65536 } !upload || … !upload_path` — тело больше `REQUEST_BODY_MAX_BYTES`
вне `POST ^/api/v1/chats/[^/]+/attachments$` (то же выражение, что у
`set-timeout`) — 400 в формате контракта с `request_id` = `X-Request-Id` =
`%[unique-id]`, тело к реплике не идёт; на пути загрузки предела LB нет:
он опередил бы 404 постороннему с 30 MiB. Тело частями меряет реплика.
Предел частоты входа в LB (`stick-table`) не ставится: LB не знает исхода
входа и username (design, решение 3).
- `balance roundrobin`, без `cookie` и `stick-table`: sticky session
запрещён (README, п. 3), а разные `X-Instance-Id` у запросов одной
сессии — проверка уровня 3.