Threat Modeling
Identify what can go wrong in a design before it is built, and record the mitigations chosen.
IntermediateSecure CodingApplicationGovernance
Where it fits in the lifecycle
- Plan
- Code
- Build
- Test
- Release
- Deploy
- Operate
- Monitor
- Plan Threat modeling, requirements and security design decisions.
Overview
A lightweight threat model is a diagram of components and trust boundaries plus a structured discussion of what an attacker could do at each boundary, and what mitigates it.
Why it matters
Design-level flaws cannot be scanned for and are the most expensive to fix later.
How it works
- 01Draw the system: components, data flows, trust boundaries.
- 02Walk boundaries with STRIDE or a simple 'what could go wrong' prompt.
- 03Record threats, decisions and accepted risks in the repository.
- 04Revisit when the architecture changes materially.
Common tools
OWASP Threat DragonMiroGitHub
Implementation examples
markdownThreat model record
## Boundary: public API -> payments service- Threat: tenant A reads tenant B invoices (Elevation of privilege)- Mitigation: tenant ID derived from token claims, never from request body- Test: integration test asserts cross-tenant read returns 404- Status: implementedBest practices
- Timebox to one session per significant design.
- Attach a test to every mitigation.
Common mistakes
- Producing a large document nobody revisits.