Home / Learn Secure SQL / Threat Modeling Basics

Threat Modeling Basics

Thinking through what could go wrong, before writing the code.

The gistThinking through what could go wrong, before writing the code.

The idea, explained simply

Threat modeling in the design processfeature design beginsthreat modeling: whatcould go wrong, and…design adjustedbefore any code is…
Threat modeling in the design process

What it is

Threat modeling is a structured exercise, done early in designing a feature, where a team deliberately asks "what could go wrong here, and who might want to make it go wrong" for the specific system being built, rather than applying generic security advice without considering the actual design.

Why it matters

Catching a design-level security gap (an unclear trust boundary, a missing access check) during threat modeling is far cheaper than catching it after the feature is built and shipped, closing the loop with the 'secure by design' mindset introduced earlier in this course.

Mechanically speaking

For any feature handling sensitive data or an access-control decision, spend a short, structured session early in design asking what could go wrong and who might benefit from it going wrong, documenting the answers and any resulting design changes.

Shows up in

  • Web application code review
  • Backend development
  • Database administration

The next lesson, STRIDE, gives one popular, structured framework for organizing exactly this kind of thinking, rather than approaching it unstructured each time.

Check yourself

1. Threat modeling is best done...