Lesson 12 of 14 · Assurance and response
Threat modelling a platform
Find the weaknesses in a platform design before an attacker does: draw the data flows and trust boundaries, walk STRIDE across each boundary, prioritise by likelihood and impact, and turn the result into owned backlog items. Worked example: the delivery pipeline.
Why model threats
Reviews after an incident always find the same thing: the weakness was visible in the design. Threat modelling is a structured way to look at a design and ask what can go wrong, what are we doing about it, and did we do enough. It is cheapest during design, and useful again whenever the design changes.
Before a school trip, teachers walk the route on a map: where could a child get lost, which roads are busy, where is the river? Then they plan: extra helpers at the busy road, a rope near the river. They don't wait for someone to fall in.
Step 1: draw the system
A data flow diagram with four kinds of element: external actors, processes, data stores and data flows. Then draw trust boundaries wherever trust changes:
┌──────────── trust boundary: internet │ platform edge ─────────────┐
Users ──► CDN/WAF ──► gateway ──► services ──► databases, object storage
Partners ─► │ ▲
▼ │ (mesh mTLS)
┌──── trust boundary: tenant A │ tenant B (logical, in shared cells) ──┐
Engineers ─► SSO ──► cloud console / kubectl (human → platform)
Git ──► CI runners ──► registry ──► GitOps controller ──► clusters (delivery path)
└──── trust boundary: CI │ production; registry │ cluster ─────────────┘
Step 2: walk STRIDE across each boundary
For each flow that crosses a boundary, ask the six STRIDE questions (see the cheat sheet). Example, the gateway → services boundary:
- Spoofing: can a pod inside the cluster call services pretending to be the gateway? → strict mTLS + identity-based policy.
- Tampering: can someone alter the user identity header? → services accept identity only from verified tokens, headers stripped at the edge.
- Information disclosure: can tenant A's token read tenant B's data? → tenant enforcement in services and the database, cross-tenant tests.
- Denial of service: can one tenant exhaust a shared service? → per-tenant rate limits, quotas, cells.
Step 3: prioritise and assign
Score each threat roughly by likelihood (how easy, how exposed) and impact (data, tenants, money, trust). Fix the high/high ones first. Each mitigation becomes a backlog item with an owner and a date, exactly like a feature.
Worked example: the delivery pipeline
The pipeline is often the most powerful identity in the platform, so model it carefully:
| Threat | STRIDE | Mitigation |
|---|---|---|
| Malicious code merged without review | T, E | Protected branches, required reviews, CODEOWNERS for sensitive paths |
| Compromised dependency | T | Pinned versions, review of updates, SBOMs, scanning |
| Stolen long-lived deploy credentials | S, E | No stored secrets: OIDC federation from CI to the cloud, short-lived tokens |
| A build job that persists between runs | T | Ephemeral, isolated runners; no shared caches across trust levels |
| An image swapped in the registry | T | Deploy by digest; signatures and provenance verified at admission |
| "Who deployed this?" unanswerable | R | Signed commits, pipeline and GitOps history, audit logs |
| One pipeline identity that can do everything | E | Separate identities per environment; production deploys only through the GitOps controller |
Find the crown jewels
Ask: which single identity, if stolen, hurts most? It is usually the CI/CD deploy identity, a cluster-admin ServiceAccount, a cloud admin role or the root CA key. Make sure each is minimal, short-lived where possible, separated by environment and heavily monitored.
Keep it lightweight and repeatable
- A one-hour session with the people who know the design beats a 50-page document nobody reads.
- Keep the diagram and findings next to the code (Markdown, diagrams as code).
- Revisit on significant changes: a new external integration, a new data store, a new tenant model.
- Use MITRE ATT&CK (including its containers matrix) to check you have not missed common attacker techniques.
Try it
Pick a small system you know (an app with a gateway, two services and a database, deployed by CI and GitOps). Draw its data flows and trust boundaries, then list at least two threats per STRIDE category. Score them, pick the top three, and write each as a ticket with an owner. Time-box it to 60 minutes.
Recap
- Draw data flows and trust boundaries, then walk STRIDE across every boundary.
- Prioritise by likelihood and impact; mitigations become owned backlog items.
- The delivery pipeline and other powerful identities are the crown jewels: minimise, separate, shorten and monitor them.
This site is a public version of my personal engineering knowledge hub. It intentionally excludes confidential company information and internal operational details.