Auto-detection

wyrm init reads your infrastructure-as-code and generates a baseline Open Threat Model β€” the topology, trust boundaries, and dataflows, inferred from what already describes your system. You review it and add the one thing code can't know: which data is sensitive.

How it works

wyrm init                          # auto-detect compose in the current dir
wyrm init --from k8s/               # a directory of Kubernetes manifests
wyrm init --from main.tf -o -       # print to stdout
wyrm init --from tfplan.json        # a Terraform plan (fully expands modules)
wyrm init --from ./chart            # a Helm chart (rendered via `helm template`)
wyrm init --from ./overlay          # a Kustomize overlay (rendered via kustomize)
wyrm init --from gitops/            # ArgoCD/Flux β€” follows each app to its local source
wyrm analyze                        # then find the threats in the baseline

🚒 GitOps: wyrm follows ArgoCD / Flux to the workloads they deploy

An ArgoCD Application or a Flux Kustomization/HelmRelease is a pointer, not a workload. wyrm reads the pointer's source.path (Argo), path (Flux Kustomization) or chart path (HelmRelease), resolves it against the scan root, renders that local Helm chart / Kustomize overlay / manifests, and folds the workloads into the model β€” so the app the pipeline actually ships is what gets analysed. A source in a remote git repo can't be followed offline: wyrm emits a note telling you to clone it locally and re-run, rather than silently dropping it.

Kubernetes-native controls become mitigations that downgrade findings, the same way a WAF or IAP does: a default-deny NetworkPolicy, an Istio AuthorizationPolicy, and STRICT mutual-TLS (PeerAuthentication) each attach to the workloads they govern; an egress NetworkPolicy/FQDNNetworkPolicy is recorded too. So a locked-down mesh no longer scores like a wide-open one.

🌐 Environments: slice the model by prod / staging / …

wyrm stamps an environment attribute on each component so a model spanning many envs can be filtered and risk-weighted per env β€” statically, with no plan. Three signals, in order:

  • Path (default) β€” a directory whose next segment names the env (environments/prod/… β†’ prod). Markers default to environments/envs/env.
  • Scope map β€” for repos where the env is a variable, not a folder, assert dir-prefix β†’ env yourself (longest prefix wins).
  • Literal label β€” a resource labels/tags value (interpolated var.environment values are skipped, not guessed).

Tune it in .threatmodel/environments.yaml:

pathMarkers: [environments, envs, env]   # dir segment before the env name
scopes:                                   # for var-based layouts
  uapi: prod
  infra/core: shared

Where one root module deploys to many envs via a var.environment, no static signal can name a single env β€” those components stay unclassified rather than mislabelled.

🧩 Multiple sources: one model for the whole system

Pass --from more than once to combine repos into a single model β€” the Terraform that provisions the clusters and the GitOps repo that deploys onto them, together:

wyrm init --from infra-terraform/ --from gitops-manifests/ -o system.otm.yaml

Each component is tagged with its source (terraform/kubernetes), and Kubernetes workloads are re-homed into the cluster trust zone of their environment β€” so an app lands in the cluster it actually runs on. Clusters and workloads match by env name; reconcile spellings or pin the mapping explicitly in .threatmodel/environments.yaml:

aliases: { production: prod }        # TF says production, ArgoCD says prod
clusterMapping: { prod: tz-cluster-main }   # or pin it outright

Per-env cluster linking is exact when the Terraform side has concrete clusters (a terraform show -json plan); from raw HCL where clusters live behind module calls, workloads fall back to the single cluster zone if there's one.

🧩 Terraform modules: point wyrm at a plan for full resolution

Reading .tf directly, wyrm sees resources inside local modules but can't expand count/for_each or reach registry/git modules β€” the same blind spot every HCL scanner has. For a complete, collision-free picture, feed it the plan Terraform already resolved:

terraform plan -out=tfplan
terraform show -json tfplan > tfplan.json
wyrm init --from tfplan.json

Every resource then arrives with its module-scoped address (module.data.google_sql_database_instance.main) β€” modules unnested, instances expanded, nothing lost to name collisions. Same detection rules, exact topology.

Reading raw .tf without a plan still works for multi-module and multi-env layouts: wyrm walks every .tf file and, when the same resource name appears in two different module directories, path-qualifies the colliding ids (envs-prod-aws_db_instance-main vs envs-dev-…) so neither is clobbered. Names unique to one directory keep their clean id.

It writes .threatmodel/<project>.otm.yaml. Two principles guide every rule:

What it detects

Status: shipped building planned

Docker Compose shipped

SignalBecomes
servicecomponent (type inferred from image)
published portsinternet ingress dataflow
depends_ondataflow between services
image is postgres/mysql/redis/…database / data-store in a data tier

Kubernetes & Istio shipped

SignalBecomes
Service type LoadBalancer / NodePortinternet-facing component
Service type ClusterIPinternal component
Ingress (+ backends)edge entrypoint + dataflows; tls β†’ encrypted
Istio Gateway / VirtualServicemesh edge + routing dataflows
loadBalancerSourceRangesmitigation (source-IP allowlist)
NetworkPolicy, Istio AuthorizationPolicy / mTLStrust boundary / mitigation
CNI: Flannel vs Calico/Ciliumwhether NetworkPolicy is actually enforced

Terraform β€” AWS / GCP / Azure shipped

SignalBecomes
AWS aws_lb.internal = false, API Gatewayinternet-facing LB / API
AWS aws_security_group ingress 0.0.0.0/0world-open port
GCP forwarding_rule EXTERNAL*, public GKEinternet exposure
GCP iap {}, master_authorized_networksmitigation (auth / allowlist)
GCP Cloud Armor attached to a backend (security_policy), *_security_policyWAF mitigation linked to the HTTPS ingress β€” downgrades edge exposure
Azure public frontend_ip_configuration, azurerm_public_ipinternet-facing frontend
google_compute_network / aws_vpc / azurerm_virtual_networktrust zone (VPC)
google_compute_subnetwork / aws_subnet / azurerm_subnettrust zone (subnet segment)
GKE / EKS / AKS clusteredge control-plane node + a private "Cluster (internal)" zone for its workloads
a dir with both Terraform and Kubernetes manifestsone combined model β€” k8s workloads land in the TF cluster's zone

WAF, DDoS, reverse proxies & access control planned

SignalBecomes
Cloudflare managed/custom WAF, rate limiting, bot managementmitigation (mode: block vs log)
Fastly WAF / Next-Gen WAF (Signal Sciences)mitigation (+ coverage %)
AWS WAFv2 & Shield, GCP Cloud Armor, Azure WAF & DDoSmitigation on the ingress flow
Pangolin, Cloudflare Tunnel (cloudflared), ngroktunneled edge β€” no direct internet port + auth mitigation
Authelia, Authentik, oauth2-proxy, Keycloak, Pomerium; Traefik forwardAuthmitigation (authentication / SSO)
Istio oauth2 ext-authz / JWT RequestAuthenticationmitigation (auth at the gateway)
fail2ban, CrowdSec; IP allowlists (Traefik ipAllowList, nginx allow/deny)mitigation (intrusion prevention / source allowlist)
Tailscale tailnet / subnet routerprivate trust zone (not internet-exposed)
tailscale funneldeliberate internet exposure

The full signal→OTM mapping, with exact resource/attribute names, lives in DETECTION.md. Want a source wyrm doesn't cover yet? Issue #12 tracks the roadmap.

Annotate what it can't detect

A generated baseline captures structure. It can't know sensitivity (which data is PII), how access is provisioned, or which services talk to each other internally. You supply that context through annotations β€” two channels, one schema (full spec in ANNOTATIONS.md):

Precedence is inline > external > generated, and your direct edits to the .otm.yaml still win on merge β€” so it all composes and survives regeneration.

# .threatmodel/data.yaml
assets:
  - { id: pii, name: Customer PII, risk: { confidentiality: 100 } }
resources:
  google_container_cluster.workloads:
    assets: [pii]
    flows: [google_sql_database_instance.main]     # ← declare an internal dataflow
  google_project_iam_member.cluster_admin:
    type: identity
    provisioning: manual        # manual | approval | attribute-based | jit
    privilege: high

πŸ’‘ The sleeper feature: flows

Terraform and the like describe resources, not the traffic between them β€” so a generated cloud model often has components but few edges, and STRIDE rules need edges to fire. The flows key lets you declare the internal dataflows the code can't express: flows: [db, cache] on a service says "it talks to these." Suddenly analyze has a graph to reason over β€” a sensitive flow crossing a trust boundary becomes a finding that simply wasn't visible before. It's the smallest annotation with the biggest jump in signal: a handful of flows: lines turns an inventory into a real data-flow diagram.