Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2.4 KiB
Модель угроз
Активы: password hashes, Bearer sessions, messages and attachments, PKI keys, OpenBao tokens and telemetry. Actors: chat member, outsider, a client with a certificate from the local CA, compromised worker and operator. Public boundary is HTTPS nginx; each compose service and OpenBao are separate trust boundaries. The exact links are in the trust matrix.
| Threat / path | Invariant and control | Reproducible negative check | Residual risk |
|---|---|---|---|
| outsider reads another chat or attachment | membership check before metadata/content/S3 stream | smoke ACL cases and tests/attachments_negative.py |
authorised member may copy content |
forged X-User-Id changes principal |
principal comes only from hashed Bearer session | request with forged header stays denied | stolen Bearer token works until expiry/logout |
| password database leak enables cheap cracking | Argon2id (19 MiB, t=2, p=1), salt/params in PHC hash | inspect new password_hash prefix $argon2id$ |
parameters should be raised on stronger hardware |
| login flood exhausts Argon2 CPU | Redis-wide 10/min/user budget, 429 + Retry-After | 11 bad logins across both replicas → 429 | distributed source/usernames can still consume capacity |
| a trusted non-LB certificate calls API | API TLS requires client cert and filter allows only DNS SAN lb |
no cert, foreign CA, and api-otel cert fail |
active LB credential compromise |
| compromised worker reads API credentials | separate Bao policy, RabbitMQ/S3 identities and ACLs | worker token reading kv/.../api is deny |
worker's own scoped assets remain exposed |
| telemetry leaks content/token | structured logs only, session keys hashed, no bodies | inspect Collector/Loki records after smoke | third-party agent upgrade needs review |
| malicious image consumes worker resources | pixel, CPU/RAM and job-time limits; non-root worker | oversized/malformed upload negative tests | valid expensive images occupy bounded worker capacity |
Lifecycle: CA key and unseal shares stay with the operator and are never committed. AppRole
tokens renew/re-auth before 15-minute expiry. A sealed Bao makes new secret reads fail closed;
already-open connections continue only until their bounded credential/session lifetime. Scan
findings are triaged by reachability, fixed image version and runtime exposure rather than CVE
count alone; scripts/scan.sh records the command and reviewed findings without secrets.