Interview Prep/DevSecOps/Compliance as Code, Threat Modeling & Incident Response

What does "threat model as code" mean, and is it worth it?

AdvancedProductionCompliance as Code, Threat Modeling & Incident Response
Answer

The system model (components, data flows, trust boundaries, data classification) is written in a structured format and stored in Git. Tools then generate diagrams and potential threats automatically:

  • OWASP pytm: Python model, generates DFDs and threat reports.
  • Threagile: YAML model, risk rules and reports.
  • OWASP Threat Dragon: diagram-first, models saved as JSON in the repo.

Benefits: reviewable in PRs, versioned with the architecture, diffable. Costs: upfront modelling effort and generic generated threats that still need human judgement. It pays off for platforms with many similar services; for a small team, a diagram plus a markdown file is enough.

All DevSecOps questions Roadmap: Policy as code

More on Compliance as Code, Threat Modeling & Incident Response