NodeMotion
Live Canvas
Back to Guides & eBooks Hub
Fundamentals · Lesson 3 / 8
LESSON 03Data Flow DiagramsTrust BoundariesAttack SurfacePrivilege Crossings

Anatomy of a Data Flow Diagram: Trust Boundaries & Attack Surfaces

DFD elements, privilege crossings & spotting hidden architectural assumptions

THREAT MODELING ACADEMY · LESSON 03⏱ 11 min read

“Security bugs rarely live inside a single function—they thrive at the dashed red line where untrusted bytes cross into trusted territory.”

— Nova, Principal Security Architect
TL;DR in 15 Seconds:Every Data Flow Diagram uses four simple shapes—External Entities, Processes, Data Stores, and Data Flows—plus dashed Trust Boundaries wherever privilege or network trust changes. Most critical threats occur right at those crossings.
Nova's Field Tip:If your diagram has zero Trust Boundaries, you haven’t drawn a threat model yet—you’ve drawn a marketing slide!
TRUST BOUNDARYUntrusted ClientExternal EntityAUTH GATEAPIProcessVault DBData Store“Threats love privilege crossings! Every Trust Boundary needs a bouncer.”4 DFD Elements: External Entities, Processes, Data Flows & Data Stores.
Our Velvet-Rope Trust Boundary Bouncer checks every packet crossing from Untrusted Client into the privileged API & Vault.

When engineers draw a cloud diagram for a blog post, they focus on logos: Kubernetes here, Redis there, Kafka in the middle. When security architects look at that same diagram, they look for something invisible to most eyes: where does trust change?

Does the mobile app run on a device the user physically controls (and can jailbreak or proxy)? That is a Trust Boundary. Does an internal microservice accept webhooks forwarded from a third-party SaaS vendor? Trust Boundary. Does an admin portal talk to the same database as public read replicas? Trust Boundary.

Data Flow Diagrams (DFDs) strip away marketing fluff and expose how bytes actually move across those boundaries—making hidden attack surfaces impossible to ignore.

Section 2 · Core Theory & Visual Architecture Diagrams

The 4 Canonical DFD Elements & Trust Boundary Rules

A classic DFD needs only four elements: (1) External Entities (rectangles: users, browsers, third-party SaaS APIs outside your control), (2) Processes (circles/rounded nodes: APIs, Lambdas, workers that transform data), (3) Data Stores (parallel lines/cylinders: SQL databases, S3 buckets, caches, queues), and (4) Data Flows (directed arrows showing payload movement).

On top of those four elements, draw Trust Boundaries (dashed lines or zone boxes) whenever data crosses between different privilege levels, network segments, legal entities, or execution environments (e.g., Browser → API Gateway, Edge DMZ → Core VPC, Tenant A → Shared Vector Store).

Why? Because within a single trust zone, components generally share an identity/network baseline. Across a Trust Boundary, the receiving Process must never assume the sender is honest, well-formed, or authorized.

External Entity (Rectangle)

Actors outside your engineering control—always treat inputs from them as potentially hostile.

Process (Circle / Service)

Code that parses, validates, or routes data—this is where Spoofing, Tampering, and EoP happen.

Data Store (Database / Bucket)

Where state rests—prime target for Information Disclosure, Tampering, and Repudiation.

Trust Boundary (Dashed Line)

Marks every privilege or network transition—every crossing requires explicit authentication and validation.

Canonical DFD Elements & Trust Boundary CrossingANNOTATED VISUAL WALKTHROUGH
External EntityBrowser / PartnerTRUST BOUNDARY1ProcessOrder APIData StoreEncrypted Ledger
1
Boundary Crossing #1

Every arrow piercing this dashed line must enforce authentication, TLS, and schema validation.

2
Process Validation

Never forward raw external input straight into SQL, shell commands, or downstream internal RPCs.

3
Data Store Isolation

Keep Crown Jewel stores behind private subnets and least-privilege service credentials.

Untrusted External Entities cross the dashed Trust Boundary into a validated Process before touching the Data Store.ANNOTATED ARCHITECTURE DIAGRAM
Section 3 · Real-World Case Study & Attack Walkthrough

Case Study: The "Internal-Only" SSRF Bridge Across a Missing Boundary

An engineering team built an avatar-importer microservice (Process) that fetched a user-supplied image URL. Because the microservice sat inside the private VPC, developers assumed it was "internal" and did not put a Trust Boundary around outbound HTTP fetches.

Hidden Crossing

User URL Crossed Into Private VPC

An attacker passed http://169.254.169.254/latest/meta-data/iam/security-credentials/ as their avatar URL.

Lateral Pivot

Cloud Metadata Exposed IAM Keys

The microservice obediently fetched the internal cloud metadata endpoint and returned temporary IAM credentials in the error preview.

DFD Detection

Outbound Fetch = Trust Boundary

Drawing the Data Flow from Avatar Service → Arbitrary External URL across a Trust Boundary immediately flags Server-Side Request Forgery (SSRF)—solved by egress allowlists and IMDSv2.

Design Lesson Learned:Trust Boundaries apply to outbound flows too! Whenever untrusted input controls where your server connects, you have an attack surface.
Section 4 · Cognitive Breaks & Self-Check

There Are No Dumb Questions

Candid answers to the skeptical questions every security engineer asks first.

Q:How detailed should my DFD be—do I draw every helper class and utility function?
A:No! Keep Level-1 DFDs at the service, datastore, and external-actor level (5–15 nodes). Only zoom into a Level-2 DFD for complex authentication or payment flows.
Q:Is a message queue (Kafka / SQS) a Data Flow or a Data Store?
A:Treat it as a Data Store! Messages sit on disk waiting to be consumed—meaning they can be tampered with, replayed, or leaked if unencrypted.
Q:Why does a browser-to-backend flow always cross a Trust Boundary even if both are "our app"?
A:Because the browser runs on the user’s machine! Anyone can open DevTools or Burp Suite and alter every header, cookie, and JSON field before it leaves.
FIRESIDE CHAT · CONCEPT DEBATE

Network Diagrams vs. Data Flow Diagrams (DFDs)

Network DiagramInfra Topology

“I already drew our VPCs, NAT Gateways, and Availability Zones. Isn’t that good enough for threat modeling?”

NovaDFD Advocate

“A network diagram shows where packets can route, not what data moves or who trusts whom. A DFD exposes why an internal admin service trusting unverified JWTs is lethal even inside a private subnet.”

INTERACTIVE EXERCISE

Sharpen Your Pencil · 60-Second Brain Challenge

On a Data Flow Diagram, which crossing represents the HIGHEST priority Trust Boundary to inspect for Spoofing and Injection?

Lesson 03 Sticky-Note Recap
  • ▸DFDs use 4 simple primitives: External Entities, Processes, Data Stores, and Data Flows.
  • ▸Trust Boundaries mark every change in privilege, network zone, or execution control.
  • ▸Always examine both inbound and outbound boundary crossings (to catch SSRF and webhook spoofing).
  • ▸Keep Level-1 DFDs crisp (5–15 nodes) so teams actually read and maintain them.
Optional Interactive Practice

Practice drawing Zones, Trust Boundaries, and Data Flows visually in NodeMotion’s Live Canvas →

Practice This Pattern in NodeMotion's Live Canvas