Security

Threat Modelling

Advanced

Threat modelling is the cheapest security activity there is. Before you build, you sit down and ask: "What could go wrong, and who would make it go wrong?" An hour of careful thinking at design time often prevents a vulnerability that would otherwise take a sprint to fix and a breach to find.

You do not need a heavy framework to threat-model. You need four honest questions: What are we building? What can go wrong? What will we do about it? And did we do a good enough job? Walk through the data and trust boundaries of a feature, imagine an attacker at each one, and write down what you will do about the threats you find.

STRIDE is a useful reminder — Spoofing, Tampering, Repudiation, Information disclosure, Denial of service, Elevation of privilege. But the goal is not process for its own sake. It is to catch the unsigned webhook, the missing tenant check, or the forgeable claim while it is still a sketch. The Finperiti findings are exactly the kind of thing a five-minute threat model finds before code exists.

When and how to model

Make it real, not ceremonial

A five-minute model — inbound KYC webhook Flow: Provider → POST /webhooks/kyc → update customer status
Boundary: internet → our trusted decision logic
STRIDE:
Spoofing → anyone can POST ⇒ verify HMAC signature
Tampering → payload altered ⇒ signature covers body
Replay → resend old event ⇒ timestamp + nonce/event-id
Elevation → forged "approved" ⇒ fail closed on bad/absent sig

This is the whole exercise. Five minutes here is exactly what would have caught the Finperiti unsigned-webhook finding, before a forged "approved" could pass someone through AML.

Self-review checklist

Why it matters: The vulnerabilities that hurt most are the ones nobody thought about, not the ones a scanner finds. Threat modelling is how you think about them on purpose, early, when fixing them is a small design change rather than an incident. It gives the best return on time of anything in this section.