# Модель угроз ## Активы - Пароли пользователей и Bearer sessions; - сообщения и private attachment bytes; - PostgreSQL и MinIO credentials; - RabbitMQ credentials; - OpenBao unseal key/root token/AppRole credentials; - CA private keys и leaf certificates; - telemetry traces/logs/metrics. ## Акторы - Участник чата; - посторонний пользователь; - скомпрометированный API/worker; - оператор стенда; - внешний network attacker. | Угроза и конкретный путь | Нарушаемый инвариант | Контроль | Отрицательный тест | Остаточное ограничение | | --- | --- | --- | --- | --- | | Plain HTTP к public ingress | Должен работать только TLS | Nginx external HTTPS 8443 | trusted/untrusted CA | Host-only Docker port | | Клиент выдаёт себя за LB на API | Сервер принимает любого TLS-клиента | mTLS + SAN identity lb | no-cert/wrong-CA/rogue SAN | Учебный local CA | | Пароль пользователя крадется/подбирается | password KDF | Argon2id 19 MiB, t=2, p=1 | login rejection | Login DoS ограничен | | Fluent login abuse | API availability | shared PostgreSQL attempt counter and 429 | 35 attempts => 401/429 | In-memory Nginx burst additionally | | Посторонний читает чужой chat | Bearer и membership scope | bearer authentication and chat membership | outsider metadata/content 404/401 | no public delete/modify | | Worker получает API/OpenBao admin secret | service policy boundary | separate API/worker AppRoles | worker path denied for API role | static KV on grade3 | | External scanner читает private MinIO | private bucket/no redirect | API authorization and TLS | direct object denied/controlled | root creds on grade3 | | Telemetry exposes password/token/body | privacy telemetry invariant | no secret fields in logs/metrics | trace/log review | SDK dependencies logs can contain library internals | | OpenBao restart | secrets become unavailable | persistent file storage, init/unseal state | unseal bootstrap test | manual/operator model | ## Lifecycle - CA и leaf private keys создаются локально scripts/bootstrap-tls.py вне Git; - operator owns unseal key/root token under `.secrets/openbao.json`; - app/worker never receive root token; - AppRole SecretID/RoleID stored outside Git and mounted read-only; - ordinary OpenBao restart uses operator state and bootstrap unseal; - certificate rotation requires regenerate leaves and recreate services; - API/worker session and password revocation remain DB-authoritative.