Anatomy of a Data Flow Diagram: Trust Boundaries & Attack Surfaces
DFD elements, privilege crossings & spotting hidden architectural assumptions
“Security bugs rarely live inside a single function—they thrive at the dashed red line where untrusted bytes cross into trusted territory.”
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.
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.
Actors outside your engineering control—always treat inputs from them as potentially hostile.
Code that parses, validates, or routes data—this is where Spoofing, Tampering, and EoP happen.
Where state rests—prime target for Information Disclosure, Tampering, and Repudiation.
Marks every privilege or network transition—every crossing requires explicit authentication and validation.
Every arrow piercing this dashed line must enforce authentication, TLS, and schema validation.
Never forward raw external input straight into SQL, shell commands, or downstream internal RPCs.
Keep Crown Jewel stores behind private subnets and least-privilege service credentials.
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.
User URL Crossed Into Private VPC
An attacker passed http://169.254.169.254/latest/meta-data/iam/security-credentials/ as their avatar URL.
Cloud Metadata Exposed IAM Keys
The microservice obediently fetched the internal cloud metadata endpoint and returned temporary IAM credentials in the error preview.
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.
There Are No Dumb Questions
Candid answers to the skeptical questions every security engineer asks first.
Network Diagrams vs. Data Flow Diagrams (DFDs)
“I already drew our VPCs, NAT Gateways, and Availability Zones. Isn’t that good enough for threat modeling?”
“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.”
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?
- ▸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.
Practice drawing Zones, Trust Boundaries, and Data Flows visually in NodeMotion’s Live Canvas →