Skeleton contracts / contracts (pull_request) Blocked by required conditions
34 lines
5.4 KiB
Markdown
34 lines
5.4 KiB
Markdown
# Модель угроз
|
|
|
|
## Активы и акторы
|
|
|
|
Активы: пароли и Argon2id hashes, Bearer sessions, сообщения и вложения, DB/S3/broker credentials, TLS CA and leaf private keys, OpenBao storage/unseal material, telemetry. Акторы: внешний REST клиент, аутентифицированный участник/посторонний пользователь, процесс ingress/API/worker, оператор учебного Docker host. Рассматриваем синтетические данные на одном локальном host; доступ к Docker daemon или filesystem host означает компрометацию всего стенда и не защищается приложением.
|
|
|
|
## Границы доверия
|
|
|
|
```text
|
|
external client --HTTPS/public CA--> Nginx ingress --mTLS/service CA--> API replicas
|
|
|--> PostgreSQL
|
|
|--> S3
|
|
|--> Redis session/broker
|
|
|--> OTel Collector -> telemetry stores
|
|
`--> HTTPS/OpenBao AppRole -> scoped KV
|
|
operator --local authenticated channel--> OpenBao/Grafana administration
|
|
```
|
|
|
|
Конфигурации и текущие ограничения каждой линии перечислены в [trust matrix](../contracts/trust-matrix.md). Наружу опубликован HTTPS ingress; Grafana привязана к loopback; API ports и service ports наружу не опубликованы. На host TLS certificate generation is local. OpenBao init/unseal and role setup are operator operations.
|
|
|
|
| Угроза и конкретный путь | Нарушаемый инвариант | Контроль | Негативная проверка | Остаточное ограничение |
|
|
| --- | --- | --- | --- | --- |
|
|
| Клиент посылает password/Bearer через недоверенную сеть | Credential confidentiality | Public HTTPS leaf, CA + SAN validation | `make test-security`, неверный CA/hostname | Локальный CA — только для стенда |
|
|
| Посторонний участник подменяет `X-User-Id` или угадывает attachment ID | Идентичность и ACL должны исходить из сессии; чужие объекты не раскрываются | Bearer-only protected API, member check, чужой объект даёт 404 | Отдельный чужой token + поддельный header; metadata/content 404 | Нужны собственные API regression runs перед защитой |
|
|
| Клиент подключается напрямую к API в обход LB | Каждый API запрос должен пройти ingress boundary | API порт не опубликован; app доступен только loopback; nginx checks allowed client DN | Внутрисетевая попытка без cert/с чужой CA отвергается на client-auth boundary; неверный CN gets 403; LB identity succeeds | Docker host/root user can join the network |
|
|
| Пользователь перебирает пароли | Пароль не должен быть дешёвым для перебора; burst ограничен | Argon2id ≥19 MiB, t=2,p=1; per-replica login limit 10/minute + Retry-After | 11 login attempts from same source returns 429 | Rate limit in-memory and per replica; distributed evasion possible |
|
|
| API process/read-only filesystem attacker пытается извлечь root/unseal | Application identity must not grant operator access | OpenBao AppRole scoped KV read; operator material absent from image/repo | API policy read own path; deny worker path/write | Static SecretID local file; no automatic expiry/rotation demonstrated |
|
|
| Compromised API abuses worker credentials or bucket | Least privilege between API and worker | Distinct OpenBao policies, AppRole paths, MinIO users/prefix policies, PostgreSQL roles and Redis ACL identities | KV path deny, S3 denied-prefix probe, DB privilege review, Redis ACL negative probe | Live deny checks have not been run; static AppRole SecretID rotation is manual |
|
|
| DB/broker/telemetry traffic observed on Docker network | Service data confidentiality | PostgreSQL verify-full + hostnossl reject; Redis TLS/ACL; OTLP mTLS; Collector-to-backend TLS; Grafana datasource verification | TLS probes and logs for each channel are outstanding | Configurations are present but runtime handshake/failure behavior is unverified |
|
|
|
|
## Lifecycle and incident handling
|
|
|
|
Operator creates the public, service and Bao CAs/leaf certs locally with `infra/tls/bootstrap.ps1`. OpenBao persistent data lives in `openbao_data`; operator performs one-time init, stores quorum shares offline, enables KV v2 and AppRole, writes scoped policies and creates local role credentials. After restart the operator unseals Bao before API/worker can fetch credentials. Sealed/unavailable Bao fails closed; the app has no embedded root token or plaintext fallback. On level 3 secret rotation is manual and requires an application restart; automatic leaf/secret renewal, revocation test and scan triage are future work.
|