Threat Model
Web App
Browser, API, database: the shape most systems actually are.
- Format.puml
- Length35 lines
- LibraryC4-PlantUML
- LibraryThreat modelling
The source
35 lines of PlantUML, and pulls in C4-PlantUML and Threat modelling. Copy it, or open the template inside Gnomon and render it as it is.
@startuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
!include <threat/ThreatModel>
title Threat Model — Web Application
Person(user, "Customer", "Uses the product")
NetworkBoundary(edge, "Public Edge", "internet") {
Container(waf, "CDN / WAF", "Cloudflare", "TLS termination, rate limiting")
}
TrustBoundary(dmz, "DMZ", "low") {
Container(web, "Web App", "React", "Browser client", $tags="internet_facing")
Container(api, "API", "Node", "Business logic", $tags="internet_facing+authn_oauth2")
}
TrustBoundary(core, "Internal", "high") {
ContainerDb(db, "App Database", "Postgres", "User records", "", "pii+encrypted_at_rest+audit_logged")
ContainerQueue(jobs, "Job Queue", "SQS", "Background work")
Container(admin, "Admin Console", "React", "Support tooling", $tags="admin+mfa+authn_oauth2")
}
System_Ext(mail, "Email Provider", "Transactional email")
Rel(user, waf, "Browses", "HTTPS")
Rel(waf, web, "Serves", "HTTPS", $tags="encrypted")
Rel(web, api, "Calls", "HTTPS", $tags="encrypted")
Rel(api, db, "Reads/writes", "SQL")
Rel(api, jobs, "Enqueues", "AMQP")
Rel(admin, db, "Queries", "SQL")
Rel(api, mail, "Sends mail", "HTTPS")
THREAT_LEGEND()
@endumlRender this offline
This template ships in Gnomon and renders on your machine, with no account and nothing sent to a server. The browser editor is free and needs no install.
Others in Threat model diagrams
- Threat Model — AWSCloud-hosted, with the boundaries a VPC and IAM imply.