LESSON 2

Threat Modeling

Find what could go wrong before it does: model the system with data flow diagrams and trust boundaries, apply STRIDE, consider abuse cases and AI-specific threats, prioritize, and turn threats into requirements and tests.

Introduction

A security review of a finished system answers “what weaknesses exist?” Threat modeling answers an earlier and cheaper question: “what could go wrong, given how this system is designed?” It is a structured conversation about the system, and its output is a short list of threats, each with a decision.

SignalDesk accepts file uploads, parses them, stores them for many customers, sends parts of them to an external model provider, and shows the results. Each of those steps invites a question. This lesson teaches a method for asking the questions systematically.

Learning Objectives

  • Explain what threat modeling is and when to do it.
  • Draw a data flow diagram with trust boundaries.
  • Apply STRIDE to find threats systematically.
  • Consider abuse cases and threats specific to AI integrations.
  • Rate and prioritize threats, and choose a response for each.
  • Turn threats into security requirements and test cases.
  • Use AI to widen a threat model while keeping people in charge of conclusions.

1. The Four Questions

A threat model answers four questions, a framing used widely in the field:

  1. What are we working on? A model of the system.
  2. What can go wrong? The threats.
  3. What are we going to do about it? The mitigations and decisions.
  4. Did we do a good enough job? Review and validation.

Do it when designing a new system or feature, when the architecture changes (a new integration, a new data type, a new entry point), and when you learn of a new class of attack. A threat model is a living document, not a ceremony before release. Small and frequent beats large and rare.

2. Model the System

Draw a data flow diagram (DFD). It needs only four elements:

Element Meaning Example
External entity A person or system outside your control Customer user, administrator, model provider
Process Code that transforms data API service, import worker
Data store Where data rests Database, file storage, queue
Data flow Data moving between elements Upload, query, job message, model request

Then draw trust boundaries: lines where the level of trust changes, such as between the internet and your network, between a customer’s data and another’s, between your service and a third party, and between a worker and the database.

1
2
3
4
5
[Customer user] --HTTPS--> [Web app] --> [API service] --> [Database]
                    |                        |
          (internet boundary)               +--> [Job queue] --> [Import worker]
                                                                       |
                                              (provider boundary)      +--> [Model provider]

Threats concentrate where data crosses a trust boundary. Spend most of your attention there. For each flow, record the protocol, the authentication, what data it carries, and how sensitive that data is.

Keep the diagram at the level of detail the team can keep current. One page with eight to fifteen elements is usually enough; split it by feature if it grows.

3. Find Threats With STRIDE

STRIDE is a checklist of six threat categories. Apply it to each element and each flow that crosses a boundary.

Category Violates Question SignalDesk example
Spoofing Authentication Can someone pretend to be someone else? Stolen session token used to act as another user
Tampering Integrity Can data or code be changed without permission? Modified job message makes the worker process another tenant’s file
Repudiation Accountability Can someone deny an action, and could we prove otherwise? An administrator deletes records and no log shows who
Information disclosure Confidentiality Can data reach someone who should not see it? Error message exposes another customer’s data; logs contain feedback text
Denial of service Availability Can someone make the system unusable? Huge uploads or compressed files exhaust worker memory
Elevation of privilege Authorization Can someone do more than they are allowed? Regular user calls an administrator endpoint, or reads another tenant by changing an identifier

Work through each element systematically, asking each question. For every threat, write a short statement:

1
2
An [actor] could [action] by [method], causing [impact], because
[weakness or missing control].

For example: “A customer user could read another organization’s feedback by changing the record identifier in an API request, causing a confidentiality breach, because the API does not check ownership on every read.”

Not every STRIDE category applies to every element; skip those that do not, and say so. The goal is coverage, not a long list.

4. Abuse Cases and Attack Paths

Requirements describe what users should be able to do. Abuse cases describe what a hostile or careless user might try instead. For each important feature, ask: “How would someone misuse this?”

  • Upload: a file that is not what it claims, a decompression bomb, a file with formulas or markup that executes when someone opens an export, a file with enormous rows.
  • Sign-in: credential stuffing, password reset abuse, session theft.
  • Sharing and invitations: inviting yourself into another organization, guessing invitation links.
  • Search and export: extracting more data than intended, bypassing tenant filters.
  • API: unlimited requests, mass data retrieval, unexpected parameters.
  • Administrative features: misuse by a compromised or malicious administrator.

Also think in attack paths: sequences of small weaknesses that combine. A low-severity information leak plus a weak password reset can equal an account takeover. Ask what an attacker needs first and what each step makes possible.

5. Threats Specific to AI Integrations

SignalDesk sends customer text to an external model provider and displays what comes back. This creates a class of threats that traditional models miss:

Threat Description Typical mitigation
Prompt injection Text in an uploaded file tells the model to ignore its instructions, reveal data, or produce harmful output Treat model output as untrusted; separate instructions from data; limit what the model can access or do
Data leakage to the provider Sensitive data is sent where the contract or the customer does not permit Data minimization, redaction, contractual and configuration controls, customer consent
Cross-tenant contamination One tenant’s content appears in another’s context Strict per-request context built only from the requesting tenant’s data; no shared memory or cache without tenant keys
Unsafe output handling Model output is rendered or executed as trusted content (markup, links, commands) Encode and sanitize output; never execute it; restrict links
Excessive agency The model is allowed to trigger actions (delete, send, update) No actions from model output without validation and authorization
Cost abuse Large or repeated requests drive up the bill Rate limits, quotas, budgets, alerts
Unreliable output A confident but wrong summary misleads a decision Labeling, human review where stakes are high, feedback and evaluation

The key principle is that model output is untrusted input, however polite it sounds. Apply the same validation and encoding you would to text typed by an anonymous user.

6. Rate, Prioritize, and Decide

A long list is not a plan. For each threat:

  1. Rate it with the scale from lesson 1: likelihood and impact, with a short reason.
  2. Choose a response: mitigate, avoid, transfer, or accept.
  3. Name the mitigation as a specific control: “API checks organization ownership in a shared authorization layer” and not “improve access control.”
  4. Assign an owner and a status.
  5. Identify the evidence that will show the mitigation works (a test, a review, a configuration check).

Use a simple register:

ID Threat Element or flow STRIDE Likelihood Impact Risk Response Mitigation Owner Evidence
T-01 Cross-tenant read via identifier change API read endpoints E, I Medium High High Mitigate Central ownership check   Authorization tests

Rate honestly. If everything is “critical,” nothing is. Aim for a short top tier that the team will actually fix first.

7. From Threats to Requirements and Tests

A threat model that stays in a document does nothing. Convert it:

  • Security requirements: “Every API read of tenant data enforces organization ownership on the server” (traces to the requirements course).
  • Acceptance criteria and tests: a test that requests another tenant’s record and expects a refusal. These become part of the regression suite (lesson 8).
  • Backlog items: work needed to add missing controls.
  • Architecture decisions: record significant choices as ADRs (lesson 3).
  • Monitoring and alerts: detection for threats you cannot fully prevent, such as repeated failed sign-ins.

Link each threat to the requirement, test, or backlog item that addresses it. A threat with no link is an unaddressed threat.

8. Using AI for Threat Modeling

AI is a good brainstorming partner. It has read about many attacks and will not get bored enumerating categories.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Act as an experienced application security engineer helping with a
threat model.

Inputs:
- Data flow diagram (as text): elements, flows, trust boundaries:
  [paste]
- Data sensitivity per store and flow: [paste]
- Authentication and authorization approach: [paste]
- Features and abuse cases already considered: [paste]

Tasks:
1. For each element and each flow that crosses a trust boundary,
   list threats using STRIDE. Use the statement format: actor,
   action, method, impact, missing control.
2. List threats specific to the model provider integration and to
   uploaded content.
3. Identify attack paths that chain two or more weaknesses.
4. For each threat, propose a likelihood and impact with a reason,
   and a candidate mitigation.
5. List questions about the system that would change your answers.

Do not assume controls that are not described. Mark every assumption.
Distinguish threats that are plausible from those that are
speculative.

Then work the output properly:

  • Verify against the design. Remove threats that cannot occur given how the system actually works, and note the control that prevents them.
  • Look for what is missing. AI tends toward generic threats; ask the team about the odd parts of your system: legacy flows, scripts, admin tools.
  • Do not outsource the ratings. The model does not know your users, data, or contracts.
  • Run a second pass from a different angle: “What would a malicious customer user try? What would a compromised dependency do?”

Hold a short review meeting with the developers, an operator, and someone who understands the business impact. The conversation often finds more than the document.

9. Practical Exercise

For SignalDesk (or your project):

  1. Draw the data flow diagram with elements, flows, and trust boundaries; note authentication and data sensitivity on each flow.
  2. Apply STRIDE to every element and every boundary-crossing flow, writing each threat in the statement format.
  3. Write at least six abuse cases for the main features, including upload and sharing.
  4. Add the AI integration threats that apply to your design.
  5. Run the AI threat modeling prompt, merge its findings with yours, and remove or confirm each by checking the design.
  6. Rate every threat, choose a response, and name a specific mitigation, owner, and evidence.
  7. Convert the top threats into security requirements, test cases, and backlog items.
  8. Store the diagram, register, and links in the security workspace.

Verification

You are ready to continue when:

  • The diagram shows trust boundaries, and every boundary-crossing flow has been examined.
  • Each threat is written in a clear statement and has a rating, a response, and a named mitigation.
  • AI-specific threats are covered, and model output is treated as untrusted.
  • The top threats trace to requirements, tests, or backlog items.
  • Assumptions are written down, and someone other than the author reviewed the model.

Key Takeaways

  • Threat modeling is a structured way to find design-level problems while they are cheap to fix.
  • Trust boundaries show where to look; STRIDE shows what to look for.
  • Abuse cases and attack paths find what single-weakness thinking misses.
  • Model output is untrusted input, and AI integrations bring their own threat classes.
  • AI widens the list; the team verifies it, rates it, and turns it into controls and tests.

What’s Next?

With a prioritized list of threats, we design the controls that prevent them. The next lesson covers secure architecture: identity, access control, tenant isolation, data protection, and safe integration of external services.