Skip to content

Security

Security posture across the platform: secrets, identity, network isolation, TLS and threat models.

The platform runs on one OVH bare-metal k3s cluster behind Cloudflare. GCP holds only Secret Manager, Terraform state, OAuth clients, the Places key and FCM. Baseline principles:

  • No secrets in Git. Everything sensitive lives in GCP Secret Manager and reaches Kubernetes through the External Secrets Operator. Terraform CI signs in to GCP with Workload Identity Federation, not a key.
  • Few, scoped keys. One GCP key (Secret Manager read-only) bootstraps ESO; R2 tokens are per purpose (one for the cluster, one per env for app media); the GHCR token is read:packages only.
  • Cloudflare in front. Prod app hostnames are proxied (WAF, DDoS, edge TLS) and the origin accepts only authenticated origin pulls. Cloudflare Access gates docs.tomoda.life (GitHub org members) and loki-push (a service token); the Tunnel carries only loki-push.
  • Admin access off the public internet where possible. SSH and the k3s API listen only on Tailscale. Admin UIs sit behind oauth2-proxy with a named-operator allow-list, Argo CD behind Dex. A CI policy fails any *.tomoda.life Ingress that skips the gate.
  • App auth in the backend. The tomoda backend verifies Google and Apple tokens, passwords and passkeys, and issues its own JWTs. Per-IP limits, a per-account lockout and an IP blocker sit in front of the auth handlers, keyed on the real client IP.
  • Namespace and NetworkPolicy isolation. Dev (tomoda-dev) and prod (tomoda-prod) share the cluster in separate namespaces; NetworkPolicies limit app and Postgres ingress to Traefik, the app namespace, monitoring and the operator.
  • TLS everywhere at the edge. cert-manager issues Let's Encrypt certificates for ingress hosts; Cloudflare covers the Worker, Pages and R2 domains and enforces TLS 1.2+ and HTTPS.
  • Real client IPs. Traefik keeps the source address (externalTrafficPolicy: Local) and trusts X-Forwarded-For only from Cloudflare's ranges, so per-IP limits and blocks hit the actual client. See Traefik: client IP preservation.

Start here:

  • Secrets Management


    GCP Secret Manager bridged via External Secrets Operator. ClusterSecretStore, ExternalSecrets, rotation.

  • IAM


    The credentials the cluster uses, GCP service accounts, R2 and GHCR tokens.

  • :material-shield-network:{ .lg .middle } Network Policies


    Pod-to-pod isolation for the app pools, Postgres and NATS.

  • TLS


    cert-manager + Let's Encrypt for ingress; Cloudflare edge settings, origin lock and edge certificates.

  • Vulnerability Scanning


    Trivy Operator scans, daily GitHub issues, and upstream-fix triage.

  • Threat Modeling


    STRIDE analysis per attack surface, with a consolidated findings register.