Skip to main content

Command Palette

Search for a command to run...

Threat Modeling Basics

DevSecOps

Updated
Threat Modeling Basics
A
Manager – IT Security Engineering with experience across Application Security, Vulnerability Management, Secure SDLC, Security Reviews, and Software Quality Engineering. I help engineering teams build and deliver secure, scalable software by integrating security throughout the Software Development Lifecycle (SDLC). My focus is on identifying risks early, improving security posture, and enabling secure delivery at scale.

Threat Modeling is a structured process of identifying, evaluating, and reducing potential security threats to an application or system—before they are exploited.

It helps answer four critical questions that every DevSecOps team should consistently revisit:

1. What Are We Building?

The first step in threat modeling is to understand the system architecture. You can’t protect what you don’t understand.

Use Data Flow Diagrams (DFDs) to:

  • Visualize the flow of data across the system.

  • Map out components like:

    • APIs

    • Microservices

    • Databases

    • Queues

    • Storage systems

Define:

  • Trust boundaries — Where control changes hands (e.g., between frontend and backend, or internal vs external systems).

  • Data flows — Understand how and where sensitive data travels.


2. What Can Go Wrong?

Once your architecture is mapped, identify potential threats using structured frameworks.

Use the STRIDE Framework:

  • Spoofing

  • Tampering

  • Repudiation

  • Information Disclosure

  • Denial of Service

  • Elevation of Privilege

Common Threats in Microservices:

STRIDE CategoryThreat Example
SpoofingBroken authentication, token leakage
TamperingUnsafe API payload parsing
RepudiationLack of audit logs
Information DisclosureExcessive data exposure via APIs
Denial of ServiceAPI abuse via excessive calls
Elevation of PrivilegeInsecure role escalation

3. What Are We Doing About It?

For each identified threat, map it to specific security controls.

Security Controls That Work:

  • API Gateway + Rate Limiting

  • OAuth 2.0 / OIDC / mTLS

  • JWT Signature Verification

  • Input Validation / JSON Schema Enforcement

  • Logging and Monitoring (e.g., ELK stack, Datadog)

  • Secrets Management (e.g., HashiCorp Vault, AWS KMS)


4. Did We Do a Good Job?

Threat modeling isn't a one-time exercise—it should be validated and revisited regularly.

Verification Steps:

  • Review with security engineers and architects.

  • Automate checks in CI/CD pipelines (e.g., verify JWTs, detect missing security headers).

  • Revisit threat models during major feature releases or architecture changes.


Why Threat Modeling Matters in DevSecOps

In DevSecOps, security is a shared responsibility. Threat modeling ensures that security is integrated early and consistently:

Benefits:

  • Encourages Shift-Left security.

  • Enables risk-based prioritization in fast-paced CI/CD environments.

  • Catches design flaws before they become expensive bugs.

  • Reduces long-term security debt.


Threat Modeling for Microservices & APIs

Modern systems use APIs and microservices extensively, which introduces new challenges:

Microservices Increase:

  • Attack surfaces (each endpoint can be exploited).

  • Complexity in service-to-service communication.

  • The need for decentralized security strategies.

Threat Modeling Helps:

  • Visualize trust boundaries and data flow.

  • Identify API-specific risks like:

    • Broken auth

    • Data leakage

    • Insufficient input validation

  • Enforce proper network segmentation, encryption, and Zero Trust principles.


Zero Trust Architecture: A Core Security Principle

Zero Trust assumes no implicit trust for any user, device, or application, regardless of origin.

Key Principles:

  1. Explicit Verification:
    Every access request must be authenticated and authorized.

  2. Least Privilege:
    Grant only the minimum access necessary.

  3. Continuous Monitoring and Validation:
    Constantly validate sessions, token expiry, and behavior anomalies.

Examples in App Security:

  • Multi-Factor Authentication (MFA)

  • Device compliance checks

  • Context-aware access policies

  • Application whitelisting

  • Encryption at rest and in transit


Integrating Threat Modeling Into DevSecOps Pipelines

DevSecOps StageThreat Modeling Integration
PlanningCreate DFDs, use STRIDE in sprint discussions
CodingApply secure design patterns, update threat model
BuildAdd static checks (e.g., detect secrets/API keys)
TestInclude threat-based security test cases
ReleaseEnforce hardening guidelines from model
MonitorValidate assumptions (e.g., token TTL, access logs)

Tools That Help With Threat Modeling

Here are some reliable tools to integrate into your threat modeling workflow:

Microsoft Threat Modeling Tool

  • Uses STRIDE

  • Based on DFDs

  • Ideal for structured enterprise environments

OWASP Threat Dragon

  • Open source

  • Developer-friendly

  • Supports collaborative threat modeling


When to Threat Model

(Sooner the better , but never be too late )

  • Before the Application is build on the first place, if it already developed then just integrate threat modeling into Agile workflow.

  • Threat modeling integrates into Agile by asking “what are we working on, now, in this sprint/spike/feature?”

  • When the answer is that the system’s architecture isn’t changing, no new processes or dataflows are being introduced, and there are no changes to the data structures being transmitted there is no point of checking what can go wrong.

  • When the system changes, you need to consider the security impact of those changes, and update the threat model and work accordingly

Final Thoughts

Threat modeling isn't just a theoretical exercise—it's an essential DevSecOps discipline. In API-driven and microservices-heavy architectures, understanding what could go wrong and building defenses from day one is no longer optional—it's a necessity.


App Sec

Part 8 of 10

This series provides a comprehensive journey into the world of application security. Learn how to integrate security best practices throughout the Software Development Life Cycle (SDLC).

Up next

Building Sustainable Security Requirements with OWASP ASVS | NDC Conference

Josh Grossman's talk at NDC Security