03 December 2026

Threat Modeling SDLC: Where Security Design Fits

Reza Khosravi

Table of Contents

Threat Modeling SDLC: Where Security Design Fits

A threat model exists for the service you own. It sits in a wiki page last edited fourteen months ago by an engineer who has since moved teams. It describes a monolith you've half replaced, lists nine threats with no owners, and names two components that no longer exist. Nobody opened it during the last three sprints, and you shipped a partner-facing API anyway.

That page isn't a threat model. It's a record of a meeting. A working model is smaller, plainer, and tied to code: it names what you're protecting, where data crosses from one zone of trust into another, which threats those crossings create, and which ticket, test, or pull request proves each mitigation exists.

The shift is less about tooling than about placement. Get threat modeling into the SDLC at the points where design decisions are still cheap to change, and the artifact stops rotting.

Where Threat Modeling Fits in Each SDLC Phase

A team is adding card payments to a marketplace app. The feature works, the tests pass, and launch is two weeks away. Then a security review lands and asks where the authorization check sits on the refund endpoint, why the webhook handler trusts a signature header it never verifies, and who signed off on storing card details in the order table. Answering takes three weeks and the launch slips.

None of those questions required a specialist's intuition. Each one would have surfaced in a forty-minute conversation about the design, back when the design was a whiteboard drawing.

Threat modeling isn't a meeting on the calendar. It's a thread through the whole lifecycle, pulled at different depth as a system moves from idea to running service. The mapping below shows what that thread looks like phase by phase.

SDLC phaseThreat modeling activityOutputOwner
PlanningIdentify assets, abuse cases and compliance needsSecurity requirements listProduct and security
Architecture and designDecompose the system, map trust boundaries, rank threatsThreat model and mitigationsArchitects with security
ImplementationTurn mitigations into coding rules and guardrailsSecure coding requirementsDevelopers
Code reviewCheck each pull request against the model and policiesReview decision and merge gateReviewers
TestingVerify each mitigation with a testTest cases tied to threatsQA and security testing
DeploymentConfirm configuration matches the approved designDeployment checks and evidenceDevOps
OperationsRefresh the model after incidents or major changeUpdated threat modelService team

Read the owner column top to bottom and notice it never sits still. That movement is the point. A model owned by one person in one phase becomes shelfware; a model handed off with each phase stays attached to the work. The code review row is where this becomes concrete: the reviewer isn't guessing at intent, they're checking the pull request against threats the design already named. And the final row never closes. Operations feeds straight back into planning the moment an incident or a significant change lands, which is what makes the artifact living rather than historical.

Microsoft is the reason this shape became standard. It formalized threat modeling as an engineering activity in 1999 with an internal paper titled "The threats to our products," then folded it into its Security Development Lifecycle alongside training, code review, testing and release gates rather than trailing behind them. The company's experience report on the Security Development Lifecycle credits that discipline with reducing security defects by roughly 50% to 60%. Treat that figure as directional rather than a promise: it came from one company's environment, measured against its own earlier baseline, and your mileage depends on how faithfully the phases connect.

Most organizations already have the scaffolding for this. If your product team documents its custom web app development phases, those documented stages are the natural place to hang a security step, because that's where design intent gets written down while it's still editable. You don't need a parallel security process. You need one extra question inside the process you already run: what could go wrong here, and whose job is it to check?

Start at design. If you fix only one phase, fix that one. Redrawing a trust boundary on a diagram costs a conversation; the same boundary changed after release costs a migration. Every later row in the table gets easier once the design row is honest, because testing, review and deployment all inherit their checklists from it.

What a Threat Model Contains and Why Trust Boundaries Matter

Think of a threat model as the floor plan of a building with security written on it. The plan shows rooms, doors and windows. The annotations show which doors lock, where cameras point, which windows are wired, and who holds keys to which room. Strip the annotations and you have architecture. Keep them and you have something you can act on.

A working model has four parts, and the fourth is the one teams skip.

  • Assets are the things that would hurt if they leaked or changed: card tokens, patient records, session keys, the pricing engine's integrity.
  • Entry points and actors are how data and people reach the system: the public API, an admin console, a partner webhook, a scheduled job.
  • Data flows show how information moves between components, which is where most threats live.
  • Trust boundaries mark where data crosses from a less trusted zone into a more trusted one, such as the internet into an API gateway.

The four parts are easier to hold onto as a picture than as a list.

An illustrated diagram explaining components of a threat model and the importance of establishing trust boundaries.

Take a mobile app calling a payment API. The boundary sits between the phone and the API gateway, and everything the gateway accepts from that side deserves suspicion: token theft, replayed request bodies, tampered amounts, a client that lies about which merchant it belongs to. Inside the boundary, between the gateway and the settlement service, the threats change character, which is why a single "is it encrypted" checkbox never covers both sides.

Four questions carry most of the practice: what are we building, what can go wrong, what are we going to do about it, and did we do a good enough job?

That framing isn't a diagramming habit. NIST SP 800-218 treats threat modeling as a software-design control: Practice PW.1.1 recommends threat modeling, attack modeling, or attack-surface mapping to assess software risk, and the guidance asks teams to analyze risks, communicate them, and implement mitigations. The mechanism is simple. Modeling turns architectural assumptions about trust boundaries, data flows and privileged operations into explicit security requirements while changing them is still cheap.

Diagrams rot faster than code. Rebuilding one by reading the repository is often the quickest route back to accuracy, and data flow diagrams from source code covers how to do that systematically when the original drawings are gone.

Then there's the misconception worth killing early: a model is not a document you file once. If nobody has edited it since the last architecture change, it describes a system that no longer exists.

Before your next planning session, run three checks. List the assets in one paragraph, ordered by how much damage a breach would cause. Draw the boundaries, including the ones inside your own network. Name at least three threats per boundary, and for each one write down what's holding it back.

How to Run a Threat Model in Five Steps

Give one service and one whiteboard about 60 minutes and you can produce a usable first-pass model. The method below is what I'd run with a team that has never done it. It's also close to how most organizations already work: in 2024, 88% of respondents identified STRIDE as an approach aligned with how their organization performs threat modeling, according to Threat Modeling Connect's 2024–2025 State of Threat Modeling Report.

Four people belong in the room: a developer who knows the code, an architect who knows the intended shape, a security lead who knows the threat library, and a product owner who can decide what risk is acceptable. One of them facilitates and owns the output. Without a named owner, the session produces opinions rather than decisions.

The five steps, with the reason for each

  1. Scope and assets. Write what the service does, which data it holds, and what would hurt most if that data were exposed or altered. Five sentences is enough, and the constraint forces prioritization.
  2. Data flow diagram with trust boundaries. Include users, services, databases and third-party APIs, then draw a line wherever data crosses from a less trusted zone into a more trusted one. Every missing line is a decision someone made without noticing.
  3. Identify threats per element using STRIDE. Walk each flow and ask which of spoofing, tampering, repudiation, information disclosure, denial of service and elevation of privilege apply. Ask the question of the flow, not of the whole system, or the answers get vague fast.
  4. Rank and define mitigations. Score likelihood and impact, pick a control such as authentication, input validation, encryption or rate limiting, and write the acceptance criterion. A mitigation with no acceptance criterion can't be tested or argued about.
  5. Record and assign. Link every mitigation to a ticket, an owner and a test. This is the step that keeps the model alive, because the ticket and the test survive long after the meeting ends.

The slip that ruins most first models

Teams model the happy path. They document the intended request, the intended user, the intended response, and stop. Then production teaches them about double-submitted payments, replayed webhooks and internal services calling endpoints they were never meant to reach.

Add one misuse case per flow before you close the session. For a payment endpoint, that's a captured request body replayed ten seconds later; for a webhook, it's a duplicate delivery; for an internal API, it's a call from a service that has no business making it. One row, filled in, looks like this.

Threat: replay of a captured refund request. Mitigation: idempotency keys plus request signing. Owner: payments team developer. Test: an integration test that replays a signed body and expects the request to be rejected.

STRIDE is the default lens, not the only one

STRIDE works as a first checklist because it's memorable and maps cleanly onto components and flows. It isn't the only option. Attack trees suit attacker-goal analysis, where you start from "steal the settlement file" and work backwards through the steps required. LINDDUN fits privacy-heavy reviews, where the concern is identifiability and linkability rather than spoofing. A comparison of threat modeling frameworks helps when you're deciding which to standardize on.

Design flaws get more expensive the longer they live, which is the reason to front-load the hour.

A chart illustrating that fixing software security defects in production costs 95 times more than during development.

Why Threat Modeling Early Costs Less Than Fixing Later

The cost argument is older than most of the teams hearing it, and it's still the clearest way to explain to a product manager why a design review deserves an hour of the sprint.

Stage foundAverage fix costMultiple of development cost
Development$801x
Build$2403x
QA or testing$96012x
Production$7,60095x

Read the last column slowly. A production fix runs about 95 times the cost of the same fix caught in development, and a testing-stage fix about 12 times, according to the IBM security deck that collects these commonly cited estimates. Put volume behind it: 100 defects found in development land near $8,000, while the same 100 found in production land near $760,000. The same material notes that roughly 80% of development costs can go into identifying and correcting defects.

Treat these as direction, not a price list. They're historical estimates drawn from IBM analyses, Ponemon Institute work and NIST-related research, not current market rates, and they don't describe your codebase. What survives is the shape of the curve, which anyone who has shipped a fix on a Friday afternoon already recognizes.

Why design decisions set the price

A trust boundary is a diagram edit before code exists. After release, moving that same boundary can mean a data migration, a customer notification, a regulatory review, an incident postmortem, and a chunk of trust you don't get back. The code change is rarely the expensive part. The commitments around it are.

That's why the cheapest enforcement point is the pull request that introduces the new flow, not the scanner that runs after merge. When a change opens an outbound call to a third party or exposes a new listener, the affected threats get reassessed while the diff is still open and the reviewer can see the decision beside the code.

The rule of thumb: spend the most effort at the design review, then re-check whenever the design changes. Not once at kickoff, and not only when the audit is scheduled.

A chart comparing the lower cost of early threat modeling versus the high cost of fixing security later.

Keeping Threat Models Current as Systems Change

Drift is the gap between the architecture you approved and the system currently running. It accumulates without anyone deciding to cause it. A service picks up a second database, a queue replaces a direct call, someone adds a debug endpoint that returns more fields than it should, and a year later the drawing describes software that no longer exists.

OWASP's guidance is to begin threat modeling during design and repeat it as systems change, and its workflow has four stages: decompose the application, identify and rank threats, define mitigations, and review or validate the result, as laid out in the OWASP Threat Modeling Cheat Sheet. The repetition is the part teams drop.

Triggers that force a model update

  • A new external interface. Any new API, webhook or partner integration changes what an attacker can reach without credentials.
  • A new data store or data class. Card data, health records or precise location data changes the impact of every other threat in the model.
  • Changed authentication or authorization. SSO migrations, new roles, or moving permission checks from the app into the gateway.
  • A new third-party dependency. It inherits your trust boundary whether or not you've reviewed it.
  • Deployment topology changes. Containers, a CDN, a new region, or a service mesh alter which hops are inside the perimeter.
  • A new AI coding agent or tool with repository access. It reads your architecture and writes code against it, so it changes the threat surface in both directions.
  • Any security incident. An incident is proof the model missed something, which makes it the highest-value update you'll ever make.

Embedding the review in planning tools, IDEs and code review is what keeps this from depending on a monthly meeting nobody attends. A check that runs where the change happens beats a recurring calendar block almost every time.

Agents need security context, not just file access

Treat a coding agent as a workflow and authorization system rather than a code generator that occasionally writes something unsafe. Give it the approved security context it needs for the task and nothing beyond that, because a change can violate an architectural assumption while every generated file passes static analysis.

The urgency is measurable. A 2025 benchmark found that only 55% of AI code generation tasks produced secure code, meaning 45% introduced a detectable OWASP Top 10 vulnerability, and performance barely moved over time despite better code correctness (Veracode 2025 GenAI Code Security Report). The questions worth asking are narrower than "can an agent write vulnerable code": what context must it receive before it edits a regulated system, and what evidence is required before its changes merge?

That means agent identity and least privilege, careful handling of retrieved design context so it can't be poisoned, a clear separation between approved security decisions and generated suggestions, and human approval thresholds for changes that cross a boundary. Pre-deployment scanning won't catch an agent that breaks a rule the architecture depended on.

Legacy systems with missing documentation aren't a dead end. Reading the repository reconstructs most of what the model needs; we built DevArmor to rebuild security context directly from source code, mapping systems and risks even when the original documents are gone.

Run a drift check each sprint. Compare the model's component list against the repository structure and the deployment configuration, and update the model wherever they disagree.

Measuring Whether Threat Models Change Outcomes

Adoption numbers feel like progress and aren't. A team can model forty systems and never confirm that a single decision survived implementation. The tension shows up clearly in Security Compass's 2025 state of threat modeling report: more than three-quarters of respondents ranked threat modeling a top priority and roughly eight in ten expected adoption to grow, while operational barriers such as growing scope and shortages of AppSec expertise were the leading obstacles.

So measure outcomes instead of activity. Five indicators, mixed leading and lagging, give you enough to start.

IndicatorTypeWhat it reveals
Days from architectural change to model updateLeadingWhether models keep pace with change
Share of high-risk design decisions verified in codeLaggingWhether decisions survived implementation
Policy exceptions per serviceLeadingWhere teams routinely bypass controls
Vulnerabilities caught before mergeLaggingWhether modeling prevented flaws
Models with a named owner and review dateLeadingWhether models are maintained, not just written

The weighting shifts by sector. Regulated financial and health systems need an unbroken evidence trail from decision to pull request to deployment, because an auditor will ask for it. Media platforms weigh publishing velocity against exposure. Lower-regulation products care most about defects that escape to production.

Test any automation with one question: does it close a finding, or only produce a document?

Start with two measures, days from architectural change to model update and share of high-risk decisions verified in code. A security requirements traceability matrix makes the second one tractable, since each requirement can be followed to the check that proves it. Set targets only after a quarter of baseline data, never before.

Run Your First Threat Model This Sprint

Pick one feature, not the whole platform. A new interface, a new data class or a new partner integration is the right scope for a first pass, because the boundaries are visible and the threats are concrete. Run it before the next design review, not after.

  1. Write the assets for that feature in a single paragraph.
  2. Apply the five-step method and draw the trust boundaries it produces.
  3. Name one model owner and set a review date tied to the next architectural change.
  4. Link every mitigation to a ticket, a pull request check and a test, so the model stays attached to code rather than floating above it.
  5. Record the two baseline indicators and leave them alone for a quarter before setting any target.

This week, do three things: choose the feature, draw its trust boundaries on one page, and log the first two measures. Everything else compounds from there.

Your existing code review and security testing verify the model; no tool replaces that human decision. What tooling can do is keep the trail intact, which is why every DevArmor review traces back to an approved design decision or threat model, and design controls get pushed automatically into the downstream tools your team already runs.


Threat models that live next to the codebase, not in a wiki nobody opens, are what DevArmor is built for. It generates continuous threat models from the tickets, documents and repositories your team already has, then enforces the resulting controls on the pull requests that would otherwise break them. Take one service through DevArmor this sprint, and judge it on the two outcome measures rather than the number of models produced.

Table of Contents

Subscribe