Course contentsShow
← Security
Lesson 43 of 3,0522. Threat Modeling FundamentalsFree lesson

DFD Levels and Decomposition

Understand context diagrams (Level 0) versus detailed DFDs (Level 1+) and when to decompose components for deeper analysis.

DFD Levels and Decomposition

What you'll learn: How to zoom in and out of your system's complexity using different DFD levels to find security threats at the right depth.

The Big Picture vs. The Details

Imagine explaining your house security to two different people: a neighbor might only need to know "front door, back door, windows" (high-level), but a security installer needs blueprints showing every lock, sensor, and wire (detailed). Data Flow Diagrams work the same way.

Level 0: The Context Diagram

The context diagram (Level 0 DFD) shows your entire system as a single process bubble, with only external entities and trust boundaries visible. Think of it as a satellite view—you see "the building" and who enters/exits, but not what happens inside.

Example: "Web Application" connected to "Users" and "Database"—that's it.

Level 1+: Detailed DFDs

When you decompose a system, you zoom into that single bubble and break it apart into multiple processes, data stores, and flows. Level 1 reveals the major components inside. Level 2 zooms further into one of those components, and so on.

Why decompose? Because threats hide in complexity. That simple "Web Application" bubble might contain an authentication module, payment processor, and admin panel—each with different security needs and attack surfaces.

When to Go Deeper

Decompose when:

  • A component crosses trust boundaries (user input → privileged operations)
  • Security-critical operations occur (authentication, encryption, payment)
  • You find yourself saying "well, it's complicated inside there"

Stop decomposing when additional detail doesn't reveal new security concerns.

Key Takeaway: Start with Level 0 to understand the whole system and trust boundaries, then decompose security-critical or complex areas into Level 1+ to identify threats you'd miss from the satellite view.