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
+13
View File
@@ -222,6 +222,19 @@ pass». Модуль `attachment_cleanup_service`: «Finished staging cleanup pa
`attachments_count` в «Created message» и «Rejected message
attachments». Поле `filename` у записей — место вызова в коде
(`CallsiteParameterAdder`), а не имя файла вложения.
- С change `auth-hardening` (design, решение 9; спек `service-logging`, «Журнал защиты
входа»): модуль `session_service` — `warning` «Login rate limited»
(`retry_after_seconds`), «Password hashing is busy» (`operation=login`, `waited_ms`),
`info` «Rehashed password» (`user_id`, `updated`, `previous_memory_kib` /
`previous_time_cost` / `previous_parallelism` и текущие `memory_kib` / `time_cost` /
`parallelism` — не хэши), «Skipped password rehash» (`reason=busy`); `user_service` —
«Password hashing is busy» (`operation=register`); `login_limit` — `warning` «Login limiter
uses process counters» / `info` «… shared counters» (по одной на переход), `warning` «Login
limiter process counters are full»; `api_dependencies` — `warning` «Client address header is
missing» (`header_present`, без значения). «Started API» — ещё девять полей `auth_*`. Ни в
одной записи нет username, адреса клиента и его хэша, ключей счётчиков; под потоком отказов
записи 429 — по одной на запрос, без прореживания. Проверка — `driver.py auth-storage`
(журнал за время команды без credentials).
- Stack trace — только в лог, никогда в ответ.
## Журнал уборщика (с лабы 4)