Lesson 7 of 9 · 21m
Threat Modeling in the Development Lifecycle
Where threat modeling belongs in discovery, design, implementation, and release — lightweight enough for agile teams, rigorous enough to catch architectural mistakes.
Security teams often insert threat modeling at the worst possible time: after the design is politically finished and before the release date cannot move. The output is predictable — either everything is approved with caveats, or security becomes the department of no. Threat modeling works when it appears early enough to shape design and repeatedly enough to stay honest.
Discovery: ask threat-shaping questions before architecture hardens
At feature conception, you need only a few questions:
- Are we introducing a new trust boundary or external actor?
- Are we handling money, credentials, PII, files, messages, or tenant boundaries?
- Can users influence another user's view, workflow, or data?
- Are we adding asynchronous processing, retries, imports, exports, or integrations?
- Are we creating a powerful operation for support or administrators?
If all answers are no, record that the feature is low-risk and move on. If any answer is yes, schedule a real design threat model before implementation is too far along. This is triage, not bureaucracy.
Design: model the change, not the universe
The design document should contain a compact threat section: scope, DFD fragment, attacker actions, selected requirements, accepted risks. Example:
## Security model
New boundary: partner webhook receiver accepts asynchronous payment events.
Primary threats: forged events, replay, out-of-order application.
Requirements: SR-041 idempotency, SR-042 HMAC verification, SR-043 timestamp skew.
Accepted risk: delayed events up to 5 minutes; reconciliation job detects gaps.
Owner: payments team. Review before enabling partner sandbox.Reviewers now know exactly what to challenge. "Why do we trust the event order?" is a design question while the design can still change.
Implementation: make requirements executable
Security acceptance criteria move with the tickets. Code review asks whether the implementation matches them; tests prove the negative cases. The model is not done because a diagram exists — it is done when the important requirements have evidence.
Release: define the security gate honestly
Not every feature needs a formal sign-off. A useful gate might be:
required_before_enable:
- threat model reviewed by feature owner and security champion
- blocker findings closed or explicitly accepted by product owner
- negative tests present for authentication, replay, and tenant isolation
- audit events emitted for privileged actionsThe gate is tied to risk, not ceremony. A copy change does not need the same scrutiny as a public file-upload endpoint.
Field notes
- Threat model when the design is still cheap to change; otherwise you are doing incident prediction, not prevention.
- The best trigger is architectural novelty: new actor, boundary, data type, powerful operation, or dependency.
- Do not centralize every review in the security team. Train champions and centralize only high-risk review.
- Make the threat model linkable from the design doc and the implementation ticket; artifacts that cannot be found do not exist.
Was this lesson helpful?