Files
mtusi2026lab7-safronov/evidence/auth/passwords-and-tokens.md
T
ricoromaandClaude Opus 5.5 13fdd187c6 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>
2026-11-17 17:52:48 +03:00

36 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Пароли и токены в хранилище, пересчёт хэша, журнал без credentials
Сценарии `users` «Хэш в БД» и `sessions` «Токена нет в хранилище» (исключения сверки
покрытия), с change `auth-hardening` — ещё параметры строки хэша, пересчёт старого хэша при
входе и журнал API без credentials (задача 10.1; спек `service-logging`, «Журнал без
credentials»).
- Команда: `python3 .claude/skills/run-mtusi-messenger/driver.py --port 8443 auth-storage`
- Дата: 2026-11-17, рабочий стенд `mtusi-lab7` после `make run_docker` (две реплики).
- Код: рабочее дерево change `auth-hardening` поверх `5573973` (незакоммичено; основная
сессия коммитит его перед меткой `bench_login`).
- Код выхода: 0.
Пароли и токен — синтетические, только в памяти драйвера; username сокращены драйвером.
```text
users auth_… and auth_…: same password P (36 characters with ':' and Cyrillic)
password_hash $argon2id$v=19$m=65536,t=2,p=1$… (97 chars)
password_hash $argon2id$v=19$m=65536,t=2,p=1$… (97 chars)
hashes differ: t
session of the first user: token T (43 characters); rows of sessions with token_hash = SHA-256(T): 1, octet_length 32
pg_dump --data-only: 12 COPY blocks; T as text: no, T in hex: no, P as text: no
configured Argon2id (Started API): m=65536 KiB, t=2, p=1
rehash: user rehash_… $argon2id$v=19$m=65536,t=3,p=4 → login 201 → $argon2id$v=19$m=65536,t=2,p=1; user rehash_… $argon2id$v=19$m=65536,t=3,p=4 → wrong password 401 → $argon2id$v=19$m=65536,t=3,p=4
journal since the command: 43 records, 'Login failed' 11, 'Login rate limited' 1, 'Rehashed password' 1; failed logins of one pair: Counter({401: 10, 429: 1}); credentials in the journal: none
PASS: only Argon2id strings of the configured parameters and SHA-256 of the token are stored; old hashes are rehashed on login; the API journal has no credentials
```
## `driver.py kill-inflight` с бюджетом хэшей
`python3 .claude/skills/run-mtusi-messenger/driver.py --port 8443 kill-inflight` (затем `make
replicas`), тот же код, код выхода 0: 94 входа за 4 с восемью потоками — 201 через обе реплики
(24 и 66), 4 × 502 LB «API replica closed the connection» (`request_id` = `X-Request-Id`), 429
бюджета хэшей (допустимый исход с change) — 0: восемь одновременных входов одной пары укладываются
в 1 место и 16 ждущих бюджета и в резерв предела пары (10).