Over the course of the module we have made four security decisions, ADR-009 through ADR-012, and with them we have addressed eleven of the twelve findings on the initial list. But we have done so by following a list that came out of a one-day review: control by control, lesson by lesson. Nothing guarantees that the list was complete, or that the controls, seen together on a real flow, do not leave gaps between them. What remains is precisely finding F-12: no systematic threat analysis has ever been done at Rutaverde. Threat modeling is the technique that solves this: an orderly way of asking what can go wrong in a design before building it. In this lesson we will learn the method, apply it in a complete session with Marta, Clara, and Íñigo on two flows of the platform, and close the module by checking where each finding has ended up.

Warning. Threat modeling is a defensive design technique: it describes what could go wrong in order to decide how to prevent it, not how to carry it out. Some mitigations in this lesson involve employee data, such as the courier's location at the moment of delivery, and have legal and labor implications that must be reviewed with regulatory compliance professionals and legal counsel. The data in the case is fictitious.

Contents

  1. What threat modeling is and when to do it
  2. The four questions
  3. Data flow diagrams and trust boundaries
  4. STRIDE, category by category
  5. Attack trees
  6. Prioritizing risk
  7. Treating risk and recording threats
  8. A modeling session at Rutaverde
  9. Integrating modeling into the decision process
  10. Module review: from the findings to the security architecture

  1. What threat modeling is and when to do it

Threat modeling is a structured exercise in which a team examines the design of a system to identify what can go wrong from a security standpoint, decide what to do about it, and write it down. It requires no special tools: a whiteboard, a diagram, and the right people.

It is worth distinguishing it from other activities it gets confused with:

Activity What it examines When Who
Threat modeling The design Before building, and at every relevant change Architecture, development, operations, and security, together
Code review and automated analysis The code During development Development
Penetration test The running system Before go-live and periodically Specialists
Audit Compliance with a standard Periodically Auditors

Its advantage is economic: it finds problems when fixing them consists of changing a drawing. The finding about consecutive tracking codes would have cost one line in a design document ten years ago; today it costs a migration.

When is it done?

  • When designing a new system or component.
  • At every significant change: a new entry point, a new data store, a new third party, a change in how authentication or authorization is done.
  • Periodically, on what has already been built, because the threats and the system itself change.

It is not a document that gets written once. It is a short, repeated practice, and that is why at the end of the lesson we will tie it to the ADR process.

  1. The four questions

Every threat modeling exercise, whatever the technique used, answers four questions:

Question What is done Result
1. What are we building? Draw the system: components, data, flows, and boundaries A data flow diagram
2. What can go wrong? Walk through the diagram looking for threats with a method A list of threats
3. What are we going to do about it? Prioritize and decide on a treatment for each one Mitigations and decisions
4. Did we do a good job? Review whether the model was complete and whether the mitigations were applied Verification and improvement

The order matters. The most common mistake is to jump to the third question, discussing controls, without having drawn the system or listed the threats. That is, in a way, what we have done in this module for the sake of exposition; now we check it with the complete method.

  1. Data flow diagrams and trust boundaries

The first question is answered with a data flow diagram (DFD). It is simpler than an architecture diagram and has only five elements:

Element What it represents Example
External entity Someone or something outside our control that interacts with the system Recipient, SMS provider
Process A component that transforms or routes data Tracking service
Data store A place where data rests db-tracking
Data flow Data moving between the above "Lookup by code"
Trust boundary A line separating zones with a different level of trust or a different owner Between the Internet and the edge

The decisive element is the trust boundary. Every time a flow crosses one, the data passes from someone who is trusted less to someone who is trusted more, or the other way around. Threats concentrate at those crossings: that is where you have to authenticate, validate, encrypt, and log. A DFD with no boundaries drawn is an architecture diagram under another name.

On the platform, we have already drawn the boundaries without calling them that: they are the limits between the network zones of ADR-012, between the accounts of ADR-011, and between Rutaverde and each provider.

Two practical tips: the diagram must fit on one screen, so you model one flow at a time, not the whole platform; and every arrow must say what data it carries.

  1. STRIDE, category by category

For the second question you need a method that keeps you from depending on the inspiration of the day. The most widespread is STRIDE, an acronym for six threat categories. Each one is the negation of one of the security properties we defined at the start of the module.

Letter Category Property it violates Question it raises Typical controls
S Spoofing Authenticity Can someone pose as another user or another component? Authentication, MFA, signed tokens, mTLS
T Tampering Integrity Can someone alter data in transit or at rest? TLS, signatures, input validation, minimal write permissions
R Repudiation Traceability and non-repudiation Can someone deny having done something without our being able to prove it? Personal accounts, immutable audit logs, evidence
I Information disclosure Confidentiality Can someone see data that is not theirs to see? Encryption, authorization, minimization, unguessable identifiers
D Denial of service Availability Can someone keep the service from working? Rate limiting, DDoS protection, bulkheads, scaling, backpressure
E Elevation of privilege Authorization Can someone obtain more permissions than they have? Least privilege, server-side authorization, segmentation, isolation

Let's look at them one by one, with a Rutaverde example already covered in the module:

  • Spoofing. A third party uses someone else's API key and acts as the merchant. The answer lay in identity: keys with expiration, scopes, and revocation.
  • Tampering. Someone alters the status of a shipment, in the database or by publishing a fake event. The answer: only the monolith can publish to the bus, and each module writes only to its own schema.
  • Repudiation. With the shared account warehouse-shift2, nobody can prove who marked a shipment as delivered. The answer: personal accounts and logging.
  • Information disclosure. The consecutive codes and the public page with name and address. The answer: random codes and minimization.
  • Denial of service. A flood of tracking queries. The answer: edge, rate limiting, cache, autoscaling.
  • Elevation of privilege. The single database user: whoever compromises the Reports module obtains permissions on Billing. The answer: one user per module.

The way to use it is mechanical, and that is its virtue: for each element of the diagram and, above all, for each flow that crosses a trust boundary, you go through the six letters. Not all of them apply to everything: an external entity can spoof or repudiate; a store can be tampered with, disclosed, or overwhelmed. What STRIDE guarantees is that no category is forgotten.

  1. Attack trees

STRIDE starts from the system and asks what can happen to each piece. Attack trees go the opposite way: they start from a goal an adversary would want to achieve and break it down into the ways of reaching it. The root is the goal; each branch, an alternative path; the leaves, specific conditions the design can close off.

flowchart TB
    O["Goal: obtain recipients' personal data in bulk"]
    O --> A["Through the public page"]
    O --> B["With legitimate credentials"]
    O --> C["Through a copy of the data"]
    O --> D["Through an internal service"]
    A --> A1["Enumerating the codes: closed by 80-bit codes"]
    A --> A2["Reading data in the response: closed, there is no personal data"]
    B --> B1["A merchant API key: limited to that merchant, scopes and expiration"]
    B --> B2["Customer support account: MFA, access logged"]
    C --> C1["Backups: encrypted, separate account"]
    C --> C2["Application logs: no personal data"]
    C --> C3["Pre-production: synthetic data"]
    D --> D1["Contact interface: token, mTLS, one shipment per call"]
    D --> D2["Direct connection to db-01: denied by zones"]

This tree is a good summary of the module: each leaf is annotated with the control that closes it off or limits it. It serves two purposes that STRIDE does not deliver as clearly:

  • Seeing the alternative paths. An attacker does not need the best-protected path, but the least. There is no point in armoring the public page if the backups are unencrypted.
  • Detecting branches with no control. A leaf with no annotation is a gap.

The two techniques complement each other: STRIDE to walk through a flow in detail; a tree for the few goals that worry the business the most.

  1. Prioritizing risk

A session produces dozens of threats, and not all of them deserve the same effort. To rank them we use the tool we already know: risk = likelihood × impact, with the 1-to-3 scale and the matrix we defined at the beginning of the module: from 1 to 2, low; from 3 to 4, medium; from 6 to 9, high.

There are other scoring methods worth knowing by name:

Method What it consists of When it is used
Likelihood × impact Two factors on a short scale Threat modeling at the design stage; it is the one we use
DREAD Scores five factors: damage, reproducibility, exploitability, affected users, and discoverability A more detailed alternative; it is criticized for a degree of subjectivity
CVSS Standard system for scoring the severity of vulnerabilities, from 0 to 10 For specific, already-known vulnerabilities in products, rather than for design threats

The method matters less than applying it the same way every time and writing down the reason for each number. And a useful rule: risk is assessed with the controls that already exist or have already been decided. That is called residual risk, and it is what tells you whether something more needs to be done.

  1. Treating risk and recording threats

For each threat there are four possible treatments:

Treatment What it consists of Example at Rutaverde
Mitigate Add controls that reduce the likelihood or the impact Rate limiting, encryption, MFA
Eliminate Change the design so that the threat ceases to exist Removing personal data from the public page: what is not there cannot leak
Transfer Shift the risk to a third party DDoS protection handled by the edge provider; insurance
Accept Take it on consciously and in writing Low risks, reviewed once a year

Eliminating is the most effective and the most characteristic of the architect: the others add pieces; this one removes them. Accepting is legitimate, on two conditions: that it be accepted by someone with the authority to do so, not by whoever designs, and that it be put in writing. An ignored risk and an accepted risk look alike until the day of the incident.

Everything is recorded in a threat register, which lives alongside the rest of the architecture documentation:

- id: TH-02
  flow: public tracking lookup
  category: I
  threat: >
    The tracking code reaches third parties through side channels:
    the Referer header, the page's external resources, or logs.
  element: tracking page and edge
  existing_controls: []
  likelihood: 2
  impact: 2
  risk: 4 medium
  treatment: mitigate
  mitigation: G-01
  owner: Tracking team
  status: open
  reviewed: 2026-08-20
  • id is stable: it lets you cite the threat in an ADR or in a task.
  • category is the STRIDE letter.
  • existing_controls lists what already protects; here it is empty, and that is why it is a gap.
  • likelihood, impact, and risk capture the residual assessment.
  • treatment is one of the four; mitigation links to the measure decided on.
  • owner and status turn the threat into work that can be tracked.
  • reviewed indicates when it was last examined.

  1. A modeling session at Rutaverde

On 20 August 2026, Marta calls a two-hour session. Attending are Clara, for security; Íñigo, for operations; a developer from each flow, and you. The two flows with the most exposure are chosen: the public tracking lookup, open to anyone on the Internet, and delivery confirmation from the app, which changes the status of a shipment and gives rise to the invoice.

Flow A: public tracking lookup

Question 1: what we are building.

flowchart LR
    REC["Recipient"]
    SMS["SMS and email provider"]
    subgraph F1["Boundary: managed edge"]
        EDGE["Edge: CDN and WAF"]
    end
    subgraph F2["Boundary: rv-prod account"]
        MLB["Managed load balancer"]
        TRK["Tracking"]
        CAC["cache-tracking"]
        DBT["db-tracking"]
        BUS["event-bus"]
        NOT["Notifications"]
    end
    subgraph F3["Boundary: data center"]
        MON["Monolith"]
    end
    SMS -->|"1: message with link and code"| REC
    REC -->|"2: lookup by code"| EDGE
    EDGE -->|"3: filtered lookup"| MLB
    MLB --> TRK
    TRK -->|"4: read by key"| CAC
    TRK -->|"5: read by code"| DBT
    MON -->|"6: status events"| BUS
    BUS --> TRK
    BUS --> NOT
    NOT -->|"7: phone and text"| SMS

The boxes are the trust boundaries. Flow 2 crosses the most important one: from the Internet, where nobody is trusted, to the edge.

Question 2: what can go wrong. The team runs STRIDE over each flow that crosses a boundary. Clara moderates and always asks the same question: "with what we have already decided, is this still possible?"

Id STRIDE Threat Controls already decided Residual risk
TH-01 I Enumerating codes to obtain information about other people's shipments Random 80-bit codes and a page with no personal data (ADR-010); limit of 10 queries per second per IP (ADR-012) 1 × 1 = 1 Low
TH-02 I The code reaches third parties through side channels: the Referer header when loading external resources, third-party analytics scripts on the page, full URLs in the edge logs None 2 × 2 = 4 Medium
TH-03 T Publishing fake events to the bus to alter the statuses shown Only svc-monolith can publish (ADR-009); bus with no public exposure (ADR-011); zones (ADR-012) 1 × 2 = 2 Low
TH-04 T The response for one code is served to someone looking up another, because of a cache error The key includes the full code (ADR-005); the edge does not cache lookups 1 × 2 = 2 Low
TH-05 D A flood of queries, with nonexistent codes and from many addresses DDoS protection and WAF at the edge (ADR-012); negative caching (ADR-005); autoscaling up to 8 instances; backpressure 2 × 2 = 4 Medium
TH-06 S Fake messages that imitate Rutaverde and lead to a fraudulent page Outside the system; no complete technical control 2 × 2 = 4 Medium
TH-07 E A defect in Tracking allows someone to take control of an instance Minimal role-svc-tracking (ADR-011); no direct personal data (ADR-010); no route to the data center (ADR-012) 1 × 2 = 2 Low

Repudiation contributes no relevant threats in this flow: the lookup is anonymous and has no effects.

The discussion of TH-02 is the most valuable moment of the session. The developer mentions that the current tracking page loads a font and a visitor statistics script from third-party servers. Clara makes the connection right away: the tracking code is in the page's URL, so every external resource that is loaded receives, in the Referer header, the full URL with the code. We had made the code impossible to guess and we were handing it to third parties on every visit. Íñigo adds a third channel: the edge logs store the full URLs. No lesson in the module had dealt with this. It is the first gap: G-01.

TH-05 leaves another observation, this one from Íñigo: autoscaling turns a flood into a bill. The service holds up, but eight instances for days cost money. The risk is accepted on one condition: watching consumption and alerting. It is noted down for the next module.

TH-06 cannot be eliminated from the architecture. It is partly mitigated with design decisions (all messages link to a single domain, tracking.rutaverde.example, and the page never asks for data or payments, which can be communicated to recipients) and the rest is accepted.

Flow B: delivery confirmation from the app

Question 1.

flowchart LR
    COU["Courier and mobile app"]
    subgraph G1["Boundary: managed edge"]
        EDGE["Edge: WAF"]
    end
    subgraph G2["Boundary: data center"]
        LB["lb-01 and lb-02"]
        MON["Monolith: Delivery module"]
        DB["db-01: delivery and shipments schemas"]
    end
    subgraph G3["Boundary: rv-prod account"]
        PHO["rv-delivery-photos"]
        BUS["event-bus"]
        IDP["Identity provider"]
    end
    COU -->|"1: start of shift"| IDP
    COU -->|"2: confirmation: shipment, time, photo, token"| EDGE
    EDGE --> LB
    LB --> MON
    MON -->|"3: DELIVERED status and outbox"| DB
    MON -->|"4: photo"| PHO
    MON -->|"5: ShipmentStatusChanged event"| BUS

Question 2.

Id STRIDE Threat Controls already decided Residual risk
TH-08 S A lost or stolen phone is used to confirm deliveries Verification at the start of the shift, 10-min token, revocable refresh token, fingerprint or PIN after 30 min of inactivity (ADR-009) 1 × 2 = 2 Low
TH-09 E With a tampered app, a courier invokes another role's operations or confirms shipments on another route Server-side authorization by role and by assigned route (ADR-009) 1 × 2 = 2 Low
TH-10 T, R A courier confirms a delivery they have not made, or later denies having confirmed it; nothing ties the confirmation to the place and the moment Personal account (ADR-009). Nothing about the place or about the evidence 2 × 3 = 6 High
TH-11 T Duplicated or altered resending of operations stored during a connection drop TLS on every hop (ADR-010); idempotency key; valid token required when resending (ADR-009) 1 × 2 = 2 Low
TH-12 T, I, D The uploaded photo is not an image, is oversized, or carries metadata with the location and device details No specific control 2 × 2 = 4 Medium
TH-13 I Third-party access to the delivery photos Private, encrypted bucket, 5-min signed URLs (ADR-010); guardrail B-02 (ADR-011) 1 × 3 = 3 Medium
TH-14 D A flood of location updates prevents deliveries from being confirmed Separate rate limits for locations and confirmations, with priority for the latter (ADR-008) 1 × 3 = 3 Medium

TH-10 is the only high risk of the session, and it is raised by Íñigo, who knows the operation: "the real case is not the stolen phone; it is the delivery that is on record as done and the package that never turns up." The identity design guarantees that the courier is who they say they are and that the shipment is on their route. It says nothing about where they were, nor does it leave evidence that would stand up to a claim. It is a problem of integrity and of non-repudiation at once, and there is a nuance Marta points out: it is not always bad faith; a mis-tap in the list produces the same result. Second gap: G-02.

TH-12 emerges from following flow 4 with the six letters. Tampering: what does the server validate about the file it receives? Nothing. Denial of service: is there a maximum size? No, there is not; a photo weighs about 200 KB, but nothing prevents sending fifty megabytes. Information disclosure: photos from a phone include metadata with the exact location, the time, and the device model, which would end up visible to the merchant. Third gap: G-03.

TH-13 and TH-14 remain at medium risk because of their impact, not for lack of controls. They are accepted with monitoring.

Question 3: what we do about it

Gap Threat Treatment Mitigation decided
G-01 TH-02 Eliminate and mitigate The tracking page loads no third-party resources: fonts, scripts, and statistics are served from its own domain. Referrer-Policy: no-referrer header and a restrictive content security policy. Lookup responses carry Cache-Control: no-store. In the edge and application logs the code is stored truncated: RV-7K3M-…
G-02 TH-10 Mitigate Every confirmation carries a mandatory photo, the device's location, the device and server time, and the device identifier. The server compares the location with the geocoded address: at more than 300 meters, the delivery is accepted but flagged for review by the dispatch manager. Confirmations are stored in an append-only log. Weekly report of flagged deliveries per courier
G-03 TH-12 Mitigate Only JPEG images of 2 MB at most, and three per delivery; the limit is enforced at the edge and in the application. The server checks the file's actual type, re-encodes the image, which strips the metadata, and assigns it a name it generates itself. The location needed for G-02 is sent as separate data, not inside the photo

Two design decisions within G-02 deserve an explanation:

  • Flag, do not block. A phone's location fails in building entrances and narrow streets. Rejecting the confirmation would leave an honest courier unable to work and would clash with NFR-02. A detective control is preferred to a preventive one: it is the same criterion of degrading the function and not the service.
  • It is an employee's personal data. The location at the moment of delivery is kept as evidence of that delivery, with the same retention period as the photos; the continuous location trail keeps its 30 days. Both periods, and the information that must be given to couriers, remain pending legal review.

Question 4: did we do a good job

Before closing the session, the team checks four things:

  • Coverage: every flow that crosses a boundary has gone through the six letters.
  • Traceability: the 14 threats are in the register, with an owner and a status. Three open with a mitigation (G-01 to G-03), four accepted with monitoring, and seven closed by existing controls.
  • Verification: each mitigation will have a test that proves it works; for example, that the tracking page issues no request to any other domain.
  • What has not been looked at: shipment creation through the API, billing, and administration access are still unmodeled. Three more sessions are planned.

Clara's conclusion sums up the value of the exercise: of the fourteen threats, eleven were already covered by the module's decisions, which indicates the design is sound. The three that were not would never have been found by anyone reviewing the controls one by one; they appeared when following one specific piece of data through one specific flow.

  1. Integrating modeling into the decision process

So that it does not depend on goodwill, modeling is tied to the mechanism Rutaverde already uses to decide: the ADRs. The template gains a section:

## Security
Data affected and its classification:
Trust boundaries created or changed:
Does it require threat modeling? (yes / no, and why):
New or modified threats (register identifiers):
Controls and mitigations:
Risks accepted and by whom:

And a simple criterion for knowing when the session is mandatory. It is enough for the decision to meet one of these conditions:

Condition Example
It adds or changes an entry point from outside A new API for merchants
It adds a store or a flow with personal or confidential data A new service that stores addresses
It creates or moves a trust boundary, or brings in a third party A new provider; migrating the core to the cloud
It changes how authentication or authorization is done A new role with access to contact data

If it meets none, you write "no" and the reason, and move on. The session is sized to the change: one hour for a narrowly scoped change. The threat register is reviewed in full once a year and before every peak season, together with the failure drill day.

# ADR-013: Threat modeling in the decision process and mitigations G-01 to G-03

Status: Accepted
Date: 2026-09-03
Participants: Clara (security), Marta (architecture), Íñigo (operations), Daniel (business)

## Context
Finding F-12: no systematic threat analysis had ever been done. The
session of 20 August 2026 on two flows identified 14 threats; three
were not covered by ADR-009 through ADR-012.

## Options considered
A. Commission an annual external review.
B. In-house threat modeling, integrated into the ADRs, with STRIDE.
C. Mandatory modeling session for every change.

## Decision
We will adopt option B. Every ADR includes a security section; the
modeling session is mandatory if the change affects an entry point,
personal or confidential data, a trust boundary, or authentication
and authorization. A threat register is maintained, reviewed every
year and before every peak season. Mitigations G-01 (tracking page
with no third-party resources and no leaking of the code), G-02
(delivery evidence with location, flagging for review beyond 300 m,
and an append-only log), and G-03 (validation and re-encoding of the
photos, maximum 2 MB and three per delivery) are approved.

## Security
Data affected: courier's location at delivery (personal).
Risks accepted by Daniel and Clara: TH-05, TH-06, TH-13, and TH-14,
with monitoring.

## Consequences
Positive: F-12 is closed; security is reviewed at the moment of
deciding and not afterward.
Negative: more time per decision; option A is kept as a complement,
not as a substitute.
Risks: that the section gets filled in by rote; security will review
a sample of ADRs every quarter.

Daniel appears among the participants for a reason: accepting a risk is a business decision, and it must be signed off by whoever answers for the business.

  1. Module review: from the findings to the security architecture

This is where each of the twelve starting findings has ended up:

Id Initial finding How it was resolved Decision
F-01 Single database user with all permissions One execution user and one migration user per module, limited to its schema; a separate identity per service ADR-009
F-02 Passwords with a fast hash and no salt Passwords leave the monolith and move to the identity provider ADR-009
F-03 Internal staff without MFA and shared accounts Personal accounts, SSO, and mandatory MFA; daily verification of the courier ADR-009
F-04 Eternal API keys with no scopes Up to 5 keys per merchant, with scopes, 12-month expiration, and rotation with 30 days of overlap ADR-009
F-05 Consecutive tracking codes Random 80-bit codes, RV-XXXX-XXXX-XXXX-XXXX; no leaking through side channels ADR-010, G-01
F-06 The public page shows name and address The page, the cache, and the Tracking store contain no direct personal data ADR-010
F-07 No encryption at rest and internal traffic in the clear TLS on every hop; encryption at rest in every store; field-level encryption on three columns; keys in a KMS ADR-010
F-08 Secrets in the repository Secrets store, 90-day rotation, and replacement of all exposed secrets ADR-010
F-09 Personal data in the logs Logs keyed by shipment_id, masking, and an automated check ADR-010
F-10 Cloud with no model for accounts, permissions, or rules Five accounts, roles with no standing privileges, eight guardrails, centralized auditing ADR-011
F-11 Flat network, all-access VPN, and shared administration Eight zones with deny by default, managed edge, bastion with just-in-time access, zero trust roadmap ADR-012
F-12 No systematic threat analysis Modeling integrated into the ADRs, a threat register, and three new gaps mitigated ADR-013

And this is the resulting security architecture, seen as the layers of defense in depth:

flowchart TB
    INT["Internet: merchants, couriers, and recipients"]
    subgraph L1["Layer 1: edge"]
        EDGE["CDN, WAF, DDoS protection, and per-IP rate limiting"]
    end
    subgraph L2["Layer 2: network"]
        ZON["Eight zones, rules R-01 to R-15, deny by default"]
        LNK["Link encrypted and filtered at both ends"]
    end
    subgraph L3["Layer 3: identity"]
        IDP["Identity provider: SSO, MFA, short-lived tokens"]
        AUT["Ten roles with attributes; identity per service; mTLS on the internal interface"]
    end
    subgraph L4["Layer 4: application"]
        APP["Server-side authorization, input validation, delivery evidence"]
    end
    subgraph L5["Layer 5: data"]
        DAT["Minimization, TLS on every hop, encryption at rest and field-level encryption"]
        KMS["KMS and secrets store"]
    end
    subgraph XC["Cross-cutting"]
        CLD["Cloud: five accounts and guardrails B-01 to B-08"]
        AUD["Centralized auditing and threat register"]
    end
    INT --> EDGE
    EDGE --> ZON
    ZON --> IDP
    IDP --> AUT
    AUT --> APP
    APP --> DAT
    DAT --> KMS
    ZON --- LNK
    CLD -.-> ZON
    AUD -.-> APP

With this, NFR-09 (encryption in transit and at rest of personal data, least privilege, and GDPR compliance) is addressed as far as the design is concerned. As we did when closing the previous module, three honest caveats:

  • It is security on paper. The controls have been decided, not implemented or tested. A badly configured firewall looks nothing like its rule table.
  • Almost everything detective is yet to be built. We have decided what gets logged, not who looks at it or which alert fires.
  • The new pieces cost money. Identity provider, managed edge, KMS, secrets store, five accounts, and encryption, which costs performance. Neither the cost nor the effect on the capacity assumptions has been measured.

Common Mistakes and Tips

  • Modeling the whole platform at once. The diagram does not fit and the session never ends. One flow at a time.
  • Jumping to controls without drawing the system. Without the first question, you discuss solutions to problems nobody has stated.
  • Drawing the diagram without trust boundaries. That is where the threats are.
  • Doing it with the security team only. Whoever knows the system and the operation sees things security cannot see. Gap G-02 was found by operations.
  • Listing threats without deciding on a treatment or an owner. A list without owners is a document nobody opens again.
  • Accepting risks with no record of who accepts them. It must be whoever answers for the business.
  • Chasing the perfect list. A two-hour session every time something changes is better than a big annual analysis that goes stale.
  • Turning it into a formality. If the ADR section is always filled in the same way, it has stopped being useful.
  • Describing in full detail how an attack would be carried out. There is no need: stating what can go wrong is enough to decide how to prevent it.
  • Tip: if you only have half an hour, follow a single piece of sensitive data from the moment it enters the system until it is deleted, and ask at each boundary crossing who can see it and who can change it.

Exercises

Exercise 1

Classify each threat into its STRIDE category and state the property it violates:

  1. A merchant denies having canceled a shipment through the API, and there is no record of which key did it.
  2. Someone modifies a label stored on the NAS to change the destination address.
  3. A merchant operator discovers that they can access the API key management screen, reserved for the administrator.
  4. An attacker registers a fake service that presents itself as Notifications to the internal contact interface.
  5. A very heavy report, launched twenty times at once, overwhelms db-02.
  6. An error message from the shipments API includes the table names and the database user.

Exercise 2

Apply STRIDE to the flow "Notifications requests a recipient's contact from the monolith through the internal interface." Identify at least one threat per letter, state which control from the module covers it, and assess whether any residual risk remains that deserves attention.

Exercise 3

Rutaverde wants to add a feature: from the tracking page, the recipient will be able to change the delivery time slot or specify an alternative pickup point.

  1. Does it require a modeling session according to the ADR-013 criterion? Why?
  2. Identify the two threats that seem most serious to you.
  3. Propose a treatment for each one.

Solutions

Solution 1

  1. R, repudiation. It violates traceability and non-repudiation. Control: usage logging per API key.
  2. T, tampering. It violates integrity. Control: minimal write permissions on the store and an integrity check.
  3. E, elevation of privilege. It violates authorization. Control: checking the role on the server, not just on the screen.
  4. S, spoofing. It violates authenticity. Control: a service token issued by the identity provider, and mTLS.
  5. D, denial of service. It violates availability. Control: a limit on simultaneous executions, that is, a bulkhead.
  6. I, information disclosure. It violates confidentiality. Control: generic error messages to the outside and detail only in the internal logs.

Solution 2

Letter Threat Control that covers it
S Another service, or a compromised machine, poses as Notifications Service token with sub and audience checked (ADR-009); mTLS and rule R-13 (ADR-012)
T Alteration of the response in transit to divert the notification to another phone TLS on every hop (ADR-010)
R Contact lookups nobody can attribute Every call is recorded with who, which shipment, and when (ADR-009)
I Bulk extraction of contacts by enumerating shipment identifiers contact:read scope; minimal response; only if the shipment status justifies a notification (ADR-009)
D A fault in Notifications causes a flood of calls to the monolith Timeout and circuit breaker (ADR-008); the interface is served from the general instances
E With the Notifications token, other internal paths are accessed The name internal.rutaverde.example only routes /internal/; the token's scope only covers the contact

Residual risk that deserves attention: information disclosure if Notifications is compromised. The attacker would have a valid token and could request contacts for the shipments that are in a notifiable status at that moment. The controls bound it, but do not eliminate it. Two reasonable improvements: a dedicated rate limit for that interface, consistent with the 100 notifications per second expected at peak, and an alert when the volume of lookups does not match the volume of events received. The second is a detective control that will be fleshed out with monitoring. Denial of service also deserves a row: it is a good idea to give that interface its own limit on simultaneous calls so that it does not compete with shipment creation.

Solution 3

  1. Yes. It meets at least two conditions: it changes an entry point from outside, because the public page goes from being read-only to accepting writes, and it changes how authorization is done, because an operation with effects comes to depend solely on knowing the tracking code. If an alternative address is also collected, it adds a flow with personal data.

  2. The two most serious:

    • Spoofing with tampering: whoever has the code, which may have been forwarded or read off a screen, redirects the package to a pickup point they control. Until now, knowing the code only let you see a status; now it would let you walk away with the package. The impact goes from low to high.
    • Information disclosure: to offer "nearby" pickup points or to confirm the change, the page would tend to show part of the address, undoing the decision that the page shows no personal data.
  3. Treatments:

    • For the first, mitigate by separating reading and writing: the code is still enough to look up, but modifying requires a second step, a single-use code sent to the phone or email the merchant provided. In addition, a limit on changes per shipment, notification of the change to the original contact, and logging of every modification. It could also be partly eliminated by restricting the options to pickup points in Rutaverde's network, where collection requires identifying yourself.
    • For the second, eliminate: the page offers pickup points by postal code or city without showing the original address, and never returns recipient data.

    A common mistake is to treat the feature as "one more form" on the existing page. Modeling shows that it changes the nature of the tracking code, which goes from being a read credential to being a write credential, and that deserves its own ADR.

Conclusion

Threat modeling is the practice of asking, methodically, what can go wrong in a design while fixing it is still cheap. It rests on four questions: what we are building, what can go wrong, what we do about it, and whether we did a good job. The first is answered with a data flow diagram in which the essential thing is the trust boundaries; the second, with STRIDE, which goes through six threat categories, each the negation of a security property, and with attack trees when it is useful to start from the adversary's goal. The third requires prioritizing by likelihood and impact and choosing between mitigating, eliminating, transferring, or accepting, leaving each threat in a register with an owner. The fourth reminds us that a model is never finished. In the session on public tracking and delivery confirmation, eleven of the fourteen threats were already covered and three were not: the code that leaked to third parties from the page itself, the delivery that nothing tied to a place, and the photos nobody validated. They appeared by following a piece of data through a flow, not by reviewing controls.

This lesson brings Module 3 to an end. We started with twelve findings and four questions postponed from the previous module, and we have closed them with five decisions. ADR-009 gave people and services an identity and set who can do what. ADR-010 encrypted the data on every hop and in every store, made the tracking codes unguessable, and left the most exposed service with no personal data. ADR-011 organized the cloud into accounts, roles, and guardrails. ADR-012 divided the network into zones and charted the path to zero trust. ADR-013 made the question "what can go wrong" part of every decision. Principle P7, secure by design, now has substance.

But it should be said as frankly as at the end of the previous module: we have a platform designed to scale and designed to be secure, and both things are true only on paper. Nobody has yet verified that an instance handles fifteen creations per second, still less now that every connection is encrypted. Nobody yet looks at the logs we have decided to keep, or receives the alert when a rule denies something or a queue fills up. The 90-day certificates, secret rotation, the guardrails, and rolling deployment will only work if they are automated. And every piece added, from the edge to the KMS, has a cost that NFR-12 limits to two cents per shipment and that we have not added up. Designing a platform is half the job; the other half is operating it. In Module 4, Íñigo moves to the foreground: we will learn to optimize resources, to monitor and maintain what has been built, to automate, to validate the capacity assumptions with tests, to control cost, and to prepare the platform for the day the entire data center fails.

© Copyright 2026. All rights reserved