Defense in depth · strata/docs/hardening.md

Privacy before disk.
SPIFFE mTLS everywhere.

Strata enforces fail-closed security contracts across all five planes: pre-WAL PII/PCI HMAC tokenization, hot-reloading SPIFFE mTLS, ChaCha20-Poly1305 & AES-256-GCM envelope encryption, compiled RBAC, SSRF fail-closed DNS checks, and tamper-evident audit chains.

Pre-WAL Secrets & PCI scrubbed before fsync
SPIFFE mtime hot-reload mTLS across 6 planes
AEAD ChaCha20 + PKGRv2 AES-256-GCM keys
Fail-Closed SQL, netguard SSRF, and OIDC checks

One-way privacy funnel

Tokenize before
a byte hits WAL.

Doctor's internal/privacy engine runs during OTLP flattening — before records ever reach the local fsync WAL or MonoFS logengine.

OTLP Ingest (:4317/:4318)→ Flatten Attributes→ Secret Redact [REDACTED]→ HMAC-SHA256 + Luhn PAN Scan→ Per-Signal WAL fsync→ Encrypted Parquet + Bluge
Signal / Pattern Matched Where Applied Deterministic Output
Credential keys (password, secret, token, authorization, cookie, session, apikey, jwt, bearer, credential) Doctor pre-WAL [REDACTED]
Secret value signatures (Bearer headers, JWTs, sk-..., pk-..., API keys) Doctor pre-WAL + free text [REDACTED]
Identity, PII & PCI keys (email, user, account, client, ip, remote_addr, pan, card_number, cvv, cvc, ssn, tin, iban, routing_number, pin, dob, passport, phone) Doctor pre-WAL (per-tenant DOCTOR_PRIVACY_HMAC_KEY) tok_<16 hex> (correlatable within tenant, irreversible)
Free-text scans (embedded JWTs, emails, IPv4 addresses, SSNs, Luhn-validated PANs) Doctor log & span bodies Tokenized / redacted in place before WAL append
Cardinality & cross-trace pruning (span links, scope name/version, exemplars > 1, exp-histogram buckets) Doctor ingest Dropped or reduced to _count / _sum
Outbound LLM guard (private keys, Bearer, AWS AKIA..., sk-..., SSN, PAN) Agent redact_sensitive_text Stripped before any external LLM request

Transport security · tlsx

Hot-reload mTLS.
SPIFFE URI SANs.

All Go engines (MonoFS, Guardian, Doctor, LB-Edge, KVS) share github.com/radryc/tlsx; Agent's Python listener follows the identical STRATA_TLS_* mount contract.

Zero-Downtime Leaf Rotation

mtime-checked handshakes & URI SAN allowlists

Leaf certificate and key files at /var/run/secrets/strata-tls/{tls.crt,tls.key} are checked by modification time on handshake, rotating Vault/cert-manager certs without restarting processes.

  • STRATA_TLS_MODE=required enforces mutual TLS with peer allowlists via STRATA_TLS_ALLOWED_SPIFFE_IDS and EXPECTED_SPIFFE_IDS.
  • tlsx CLI generates local CA + per-service Secrets (gen, verify, install) for kind; production swaps in cert-manager or SPIFFE with zero code changes.
No Plaintext Non-Loopback & Strict Deadlines

Pusher guards & Slowloris protection

Non-loopback pusher read APIs (guardian-pusher-aws :19090, guardian-pusher-gcp :19091) refuse plaintext HTTP even if a bearer token is configured unless explicit allow-plaintext flags are passed.

  • guardiand, doctor-sentinel, and lb enforce ReadHeaderTimeout 10s, ReadTimeout 30s, WriteTimeout 60s, and IdleTimeout 120s.
  • lb TCP proxy enforces a 5-minute idle read/write deadline and sanitizes Host headers in /services.

Cryptographic storage

Encryption at Rest & Key Rotation

Packager & cfg

ChaCha20-Poly1305 AEAD & weak-key rejection

Every file stored via packager uses AEAD with a unique random 12-byte nonce — preventing nonce reuse under a single master key — plus an encrypted, zstd-compressed master index that hides directory layout.

  • New archive writers encrypt every entry by default and reject NoEncrypt with ErrEncryptionRequired; path traversal (.. / absolute paths) is blocked.
  • cfg requires exactly 32 cryptographically random bytes and rejects all-zero, repeated-byte, or trivially weak keys at startup (fix M-7).
Telemetry & Token Shards

PKGRv2 AES-256-GCM envelopes

pipeline/envelope.go implements PKGRv2 wrapping per-object DEKs with AES-256-GCM KEKs and KeyRingProvider rotation.

  • Set MONOFS_TELEMETRY_ENCRYPTION=envelope and MONOFS_TELEMETRY_ENCRYPTION_MODE=enforce to reject plaintext telemetry chunks on read.
  • Doctor federation stores 50k pusher credentials across 256 AES-256-GCM encrypted token shards (DOCTOR_FEDERATION_TOKEN_KEY), never embedded in catalog snapshots or logs.

Compiled RBAC policy

One compiled policy.
Default deny.

Guardian compiles access/envs/*.yaml into a versioned policy bundle served at /api/access/policy — the single runtime authorization source for Guardian, MonoFS, Doctor, and SQL.

Five Enforced Scopes

partitions · logs · traces · sql · monofs

Scopes default to deny. Roles (viewer, ingester, maintainer, admin) are scope-aware: an admin grant on aws-demo never implicitly opens unrelated partitions or signals.

  • Federated SQL is fail-closed: MonoFS router enforces --sql-require-policy (default true).
  • Grafana uses oauthPassThru: true so queries forward the user's OIDC token; OIDCVerifier rejects empty sub/client_id claims.
  • guardiand never trusts X-Forwarded-For / Forwarded requests as loopback anonymous access.
guardianctl access · policy verification
# lint against partition catalog, explain effective grants, and publish
guardianctl access lint    --file envs/prod.yaml --catalog-file catalog.json
guardianctl access explain --user [email protected] --raw envs/prod.yaml
guardianctl access who-can --scope traces --partition aws-demo --raw envs/prod.yaml
guardianctl access publish --file envs/prod.yaml --env prod

Network & build isolation

SSRF, Replay & Supply Chain

doctor / netguard

Fail-closed SSRF DNS gate

With DOCTOR_BACKEND_ALLOW_PRIVATE=false and webhook HTTPS required, netguard resolves DNS hostnames and blocks loopback, RFC1918, non-HTTP(S), and cloud metadata 169.254.0.0/16.

Guardian Alerts

Replay-protected V2 webhooks

Alert webhooks emit X-Guardian-Timestamp + X-Guardian-Signature-V2: sha256=<hmac(ts + "." + body)> so receivers reject replayed or stale alerts.

Build & CI Isolation

Env allowlists & checksum gates

monofs-pipeline-worker filters subprocess envs via a strict allowlist (never leaking worker tokens); Dockerfile.pusher-gcp aborts build without verified TOFU_SHA256.

Accountability & safety

Tamper-Evident Audits & AI Gates

kvs + doctor + nightwatch

Hash-chained ledgers & fail-stop writer chains

KVS_AUDIT_LOG and DOCTOR_AUDIT_LOG record both mutations and sensitive telemetry read queries (/v1/logs, /v1/traces, /v1/sql/query).

  • Both kvs and agent halt writer chains immediately after any unacknowledged audit insert (never silently skipping broken chain links).
  • Nightwatch persists append-only hash-chained SQLite events preserving query text, time range, source, and exact result SHA hash.
Agent & Nightwatch Guardrails

Session-bound confirmation & read-only shadow mode

Interactive mutations require confirm=true via resolve_approval bound strictly to the active session_id. Steve is excluded from all infrastructure mutation tools at prompt-build and execution time.

  • Nightwatch has zero Guardian/Doctor/Sentinel write tools and zero shell tool; telemetry payloads are treated strictly as untrusted data.
  • CORS restricts credentials whenever wildcard origins are absent; lagent_sso sets Secure=True behind TLS ingress.

Production toggles

Hardening baseline.
Copy & enforce.

Exact environment flags from strata/docs/hardening.md to lock down a cluster before sharing traffic or regulated logs.

production-hardening.env
# 1. Shared mTLS (tlsx contract across MonoFS, Guardian, Doctor, LB, KVS)
STRATA_TLS_MODE=required
STRATA_TLS_REQUIRE_CLIENT_CERT=true
STRATA_TLS_ALLOWED_SPIFFE_IDS=spiffe://strata.local/ns/monofs/sa/monofs-router

# 2. Compiled RBAC enforcement across all planes
MONOFS_ACCESS_ENFORCE=true
GUARDIAN_REQUIRE_UI_AUTH=true
GUARDIAN_ALLOW_LOOPBACK_ANONYMOUS=false
GUARDIAN_ACCESS_ENFORCE=true
GUARDIAN_ENABLE_HSTS=true
DOCTOR_ACCESS_MODE=enforce
DOCTOR_ACCESS_ENFORCE_LOGS=true
DOCTOR_ACCESS_ENFORCE_TRACES=true

# 3. Pre-WAL privacy, SSRF netguard, telemetry envelope encryption & audit logs
DOCTOR_PRIVACY_HMAC_KEY=<high-entropy-secret>
DOCTOR_BACKEND_ALLOW_PRIVATE=false
DOCTOR_SENTINEL_WEBHOOK_ALLOW_PRIVATE=false
DOCTOR_SENTINEL_WEBHOOK_REQUIRE_HTTPS=true
DOCTOR_AUDIT_LOG=/var/log/doctor/audit.jsonl
MONOFS_TELEMETRY_ENCRYPTION=envelope
MONOFS_TELEMETRY_ENCRYPTION_MODE=enforce