Files
mtusi2026lab2/evidence/auth/ttl-config.md
T
ricoromaandClaude Opus 5.5 7887e03ade fix: precompute dummy password hash at startup
- lifespan computes the dummy Argon2id hash: first unknown-user login
  takes as long as a wrong password
- evidence for session TTL from config.toml, default and environment
- REPORT.md: manual /docs check, TTL configuration row
- tasks.md: why checks ran on a separate dev database

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 19:16:18 +03:00

37 lines
2.5 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.
# Срок сессии: `config.toml`, значение по умолчанию, окружение, неверное значение
| | |
|---|---|
| Спек | `service-configuration` «Срок жизни сессии»: сценарии «Срок из config.toml», «Срок по умолчанию», «Короткий срок из окружения», «Срок не число» |
| Change | `session-auth`, доработка по `/opsx:verify` |
| Дата | 2026-10-01 16:12 UTC |
| Commit | `0cef333` |
| Стенд | сервис в console на `127.0.0.1:18081` (`python -m src`), Postgres из compose |
| Хост | Docker Desktop 29.8.1, macOS arm64; ВМ Docker: 12 CPU, 7 GiB RAM; лимиты контейнерам не задавались |
| Как снято | разовый stdlib-скрипт. Для каждого случая сервис запускается из временной копии `src/` со своим `config.toml` (из `config_example.toml` с заменённой секцией `[auth]`) и тем же `.env`; рабочий `config.toml` не трогается. Регистрация и вход, срок — `expires_at` минус момент отправки входа. Пароли синтетические и не печатаются |
## Срок новой сессии
| Случай | `expires_at` − момент входа |
|---|---|
| в `config.toml` нет секции `[auth]` | 3600,0 с |
| `[auth] session_ttl_seconds = 600` | 600,0 с |
| 600 в файле + `AUTH__SESSION_TTL_SECONDS=2` в окружении | 2,0 с |
## Неверное значение
| Окружение | Запуск |
|---|---|
| `AUTH__SESSION_TTL_SECONDS=abc` | код 1: `ValidationError` для `auth.session_ttl_seconds` — Input should be a valid integer, unable to parse string as an integer |
| `AUTH__SESSION_TTL_SECONDS=0` | код 1: `ValidationError` для `auth.session_ttl_seconds` — Input should be greater than 0 |
## Вывод
- Срок сессии — параметр `config.toml`, без него 3600 с.
- Окружение `AUTH__SESSION_TTL_SECONDS` перекрывает файл без его правки:
так проверяется истечение (`evidence/auth/expiry.md`).
- Нецелое и неположительное значение останавливают запуск ошибкой
проверки настроек.
- Контрактное имя `SESSION_TTL_SECONDS` сопоставлено с параметром в
`REPORT.md`.