# Level-4 threat model, worker bounds, TLS/ACL and telemetry audit Date: 2026-11-27 Stand: local Docker Desktop, compose project hla-lab7 Scope: README level-4 final security criterion. No credential, token, canary value or private key is recorded. ## Reproducible commands powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\test-level4-security-audit.ps1 The aggregate command invokes: .\scripts\test-mtls.ps1 python tests/security.py --base-url https://localhost:8443 --ca-file secrets/pki/public-ca/ca.crt .\scripts\test-internal-tls.ps1 docker compose --env-file .env --profile verification run --rm private-bucket-check .\scripts\test-openbao-runtime-boundaries.ps1 -SkipLivePolicy .\scripts\test-worker-resource-bounds.ps1 .\scripts\test-telemetry-redaction.ps1 For a freshly bootstrapped AppRole SecretID (TTL 24 h), include the live OpenBao allow/deny probe: .\scripts\test-level4-security-audit.ps1 -IncludeFreshOpenBaoPolicy The audit deliberately does not use an operator/root token as a fallback for an expired SecretID. The scoped OpenBao policy result is also recorded independently in evidence/openbao-policies.txt. ## Threat-to-control-to-negative-test traceability The table in security/THREAT_MODEL.md contains 13 concrete threat paths. At least the following independently reproducible paths cover the required six: 1. Ingress MITM/wrong hostname -> public CA + SAN verification -> empty/foreign trust and wrong hostname fail in tests/security.py. 2. Direct API bypass -> client-auth=need + exact LB URI SAN -> no cert, foreign CA and same-CA wrong SAN fail on each API replica in test-mtls.ps1. 3. Cross-user UUID/header abuse -> Bearer identity + membership predicates -> forged X-User-Id and outsider chat/message/attachment requests return 401/404 in tests/security.py. 4. Compromised worker -> separate DB/Redis/RabbitMQ/MinIO/OpenBao identities -> password_hash SELECT, cache key/admin commands, cross-role broker identity, MinIO admin/final delete and foreign KV access are denied by the referenced ACL/policy tests. 5. False telemetry ingest/backend access -> mTLS gateways and telemetry client CA -> no cert/foreign CA, same-CA migration role and direct backend bypass fail. 6. Authorization/body leakage -> capture disabled + Collector redaction in all pipelines -> a unique canary is absent from stdout/stderr, Loki, Tempo sensitive tag values and Prometheus label sets. 7. Image bomb/slow decoder -> byte/pixel/memory/concurrency/time/container bounds -> 10 MiB upload gets 413; 50M-pixel header and over-budget image are rejected; a slow worker job is cancelled and scheduled with processing_timeout. 8. Sealed OpenBao fallback -> scoped Agent files and startup deadline -> no operator material/fallback in app, fresh start without rendered env fails. ## Observed aggregate output PASS: 2 API replicas require a client certificate and LB CA; forbidden URI SAN is rejected; only the LB identity succeeds; no API port is published. PASS: trusted HTTPS, ACL/attachment isolation, session cap, upload and login limits. PASS: DB, S3, broker, Redis, Collector, telemetry backends and OpenBao verify server CA/hostname; all declared mTLS endpoints reject no-cert and foreign-CA clients. PASS: API/worker use distinct broker identities; trusted-CA wrong roles receive no AMQP access or OTel ingest; direct backend bypass is rejected. PASS: PostgreSQL, Redis and RabbitMQ runtime identities are separate and forbidden operations are denied. PASS: bucket is private; API and worker use separate non-admin prefix/action policies PASS: OpenBao uses persistent raft storage outside dev mode; API/worker use separate AppRoles and read-only rendered files; operator material is absent. INFO: live scoped-policy probe skipped because the local 24 h AppRole SecretID had expired; no elevated fallback was used. PASS: image memory/pixel rejection and processing-timeout retry passed as executable unit tests. PASS: worker CPU=1, RAM=1073741824 bytes, pids=256, concurrency=2, prefetch=1, pixels=40000000, image budget=536870912 bytes, job timeout=60000 ms and memory wait=2000 ms are bounded. PASS: unique Authorization/body canary was absent from container logs, Loki records, Tempo sensitive tag values and Prometheus label sets. PASS: telemetry backends were queried over CA-verified mTLS with the dedicated Grafana identity. PASS: level-4 audit covered the declared TLS matrix, same/foreign/no-cert identity failures, data-plane ACLs, bounded upload worker and end-to-end telemetry non-disclosure. ## Worker hard bounds and executable failure paths Rendered Compose and runtime docker inspect agree: CPU 1.0 core memory 1 GiB PID limit 256 JVM MaxRAM 70% of container listener concurrency 2 broker prefetch 1 decoded pixels 40,000,000 processing budget 512 MiB (fair semaphore) memory permit wait 2 s per-job timeout 60 s DB lease 90 s (must outlive timeout) Unit command: .\gradlew.bat test ` --tests com.example.mtusi_messenger.worker.ImageVariantProcessorTest ` --tests com.example.mtusi_messenger.worker.AttachmentWorkerLimitsTest ` --no-daemon --console=plain Observed: BUILD SUCCESSFUL. ImageVariantProcessorTest verifies normal transforms, determinism, rejection above the memory estimate and rejection of a 50M-pixel PNG header before decoded allocation. AttachmentWorkerLimitsTest rejects invalid timeout/lease/concurrency settings and proves that a slow operation is cancelled, acknowledged only after durable retry scheduling, and marked processing_timeout. ## TLS matrix coverage The audit verifies CA and hostname for ingress, PostgreSQL, MinIO, OpenBao, Grafana, Redis, both RabbitMQ gateways, OTel gateway/Collector, Loki, both Tempo ports and Prometheus. Every declared mTLS backend is tested with no certificate and a certificate from the wrong CA. Exact-role gateways additionally test a certificate signed by the trusted workload CA but assigned to migration/cross-role identity. Valid API, worker, Collector, Prometheus and Grafana identities pass their respective links. Runtime ACL checks execute forbidden operations rather than relying only on config: API DDL and worker users/password_hash SELECT fail; Redis outside-prefix GET/SET and CONFIG fail; RabbitMQ application permissions are separate and non-wildcard; MinIO anonymous/admin/cross-prefix/final-write-or-delete operations fail. ## Telemetry non-disclosure method test-telemetry-redaction.ps1 generates a random in-memory canary and sends it once as an invalid Bearer value and once inside a malformed JSON body. Expected 401/400 responses prove the requests reached the protected/error paths. After the export delay the script, without printing the canary: - searches recent Compose stdout/stderr; - queries Loki records; - queries Tempo values for authorization, request/response/message bodies, DB statement parameters and URL query; - searches all returned Prometheus series label sets. All searches returned zero matches. Backend queries themselves use the dedicated Grafana client certificate with CA and hostname verification.