05 Enterprise administration and integrations · Advanced
Import a data flow diagram from code
Turn an OpenAPI spec, a CloudFormation template or Terraform into a data flow diagram, review it, and build on it.
In this lesson you will learn
- Which formats you can import
- What each format turns into
- How to review the result before it's created
Start from what the code already says
Your infrastructure code and API specs already describe the system. Importing them gives you a first data flow diagram in seconds, with the right element types and trust boundaries, ready to review and threat model.
Steps
-
Open the import
On the forest page, click Import from code. Upload a file or paste it in: an OpenAPI 3 or Swagger 2 spec, a CloudFormation or SAM template, or Terraform (
.tffiles orterraform show -jsonoutput). The format is detected automatically. -
Review the preview
Click Preview. You see the diagram and every element it will create. An OpenAPI spec becomes an API consumers entity, the API as a trust boundary with a process per tag, and data flows listing methods, endpoint counts, unauthenticated endpoints and plain-HTTP servers. Cloud templates become cloud elements inside their network boundaries. Untick anything you don't want, name the diagram and click Create diagram.
An OpenAPI spec previewed as a diagram before anything is created. -
Fill in what code can't show
A spec describes the API surface, not what sits behind it. Add the data stores and downstream services by hand, then generate attack trees as usual.
Catch drift in CI. Through the API, an import can be compared with an existing diagram, so a pipeline can flag when the infrastructure no longer matches the threat model.
Practice
Try it
Import your service's OpenAPI spec or Terraform, untick anything you don't own, create the diagram, then generate attack trees from it.
This lesson covers Enterprise features. Not on Enterprise yet? Talk to us about Enterprise.
Open My ForestsQuiz
Check what you learned
Three quick questions. Your answers stay in this browser.