M5-S4 — Threat-model a solution
Section titled “M5-S4 — Threat-model a solution”| Module | M5 — Identity, access and security |
| After this session you can | Threat-model a suite and its extensions: draw its trust boundaries, find threats with STRIDE, rank them, and plan and verify the controls. |
| Time | 92 min with a facilitator · about 89 min on your own. Resume point after the lab, 75 min in (see below); the rest takes 17 min. |
| Before you start | M5-S3 (STRIDE and the vulnerability classes). Larkspur Dev open as rami.aziz; a private browser window for a second account; your terminal set up as in the workbench ($BASE pointing at Larkspur Dev, $TOKEN read). The threat-model card open. |
| Go deeper | Design your receiving endpoint · Choosing a credential · Security threat model: trust-boundary overview |
◆ Orientation (1 min) — Before Condition Monitoring is built
Section titled “◆ Orientation (1 min) — Before Condition Monitoring is built”Larkspur’s board wants condition monitoring: pumps and compressors report meter readings, a reading above its asset class’s alarm threshold raises a work order, and above the warning threshold the planner is notified. A pilot team has written a first design, and Larkspur’s internal audit has already sent you twelve findings about it and about the suite. Nothing has been built yet. That is the best moment for a threat model: every control you choose now is a line in a design, not a rework of a live system.
In this session you learn the method that turns M5-S3’s vocabulary into a reliable result, you apply it to the planned capability, and you triage the audit’s findings into a ranked plan. The extension or source strand (M7 or M8) builds the capability with your controls in it, and in the capstone (M11-S5) you threat-model your own build with the same method.
▤ Concept (10 min) — The method, the diagram and the ladder
Section titled “▤ Concept (10 min) — The method, the diagram and the ladder”Six steps
Section titled “Six steps”A threat model is not a brainstorm. It is a repeatable procedure whose result another master could check. Use these six steps, in order:
- Scope and assets. Say what you are modelling (the suite, one capability, one integration), what is out of scope (the platform’s foundation, which you take as designed), and which assets matter most. You did the asset ranking for Larkspur in M5-S3’s discussion.
- Draw the data-flow diagram. Every person and outside system, every process, every place data is stored, every flow between them, and the trust boundaries the flows cross.
- Apply STRIDE per element. For each element of the diagram, ask the STRIDE questions that apply to its kind (the table below). Write each credible threat as one line: element, category, what could happen, to which asset.
- Rank. Place each threat on the priority ladder from its impact, its likelihood and whether it is reachable from across a trust boundary.
- Choose controls. For each threat above the line, choose a control that prevents it, limits its damage, or detects it; or record an explicit acceptance with an owner.
- Verify. For each control, write the check that proves it works: a request that must be refused, a value that must be masked, a log line that must not appear. Run the check. A control that has never been checked is an assumption.
flowchart LR A["1 Scope and assets"] --> B["2 Data-flow diagram<br/>with trust boundaries"] B --> C["3 STRIDE per element"] C --> D["4 Rank on the ladder"] D --> E["5 Controls<br/>or accepted risk"] E --> F["6 Verify each control"] F -. "a check fails" .-> E F -. "the design changes" .-> B
What to notice: the model loops. A failed check sends you back to the control, and any change in the design sends you back to the diagram. A threat model is kept with the design and updated with it, not filed once.
The data-flow diagram
Section titled “The data-flow diagram”A data-flow diagram uses four kinds of element and one kind of line:
| Element | What it is | In the Larkspur capability |
|---|---|---|
| External entity | A person or system outside your control that sends or receives data | Sensors and their simulator, the CMMS, planners, a technician’s phone |
| Process | Something that transforms or decides on data | The platform’s edge, the reaction that evaluates an alarm, the reading-evaluator Function |
| Data store | Where data rests | Meter Readings, Threshold Rules, Work Orders, run histories, logs |
| Data flow | Data moving between two elements | A reading posted to the API, a work order posted to the CMMS |
| Trust boundary (dashed line) | Where the level of trust changes | Internet to platform edge; platform to the Function’s runtime; platform to the CMMS |
What to notice: logs and run histories are data stores too. They are where secrets and personal data leak most often, because nobody thinks of them as stores.
Draw at the level where trust changes, not at the level of every service. The platform behind its edge is one process in a solution’s threat model: its internal trust design (M5-S1) is the foundation you rely on, and the operator’s deployment rule (no path to a service except through the edge) is an assumption you write down, not a threat you re-analyse.
STRIDE per element
Section titled “STRIDE per element”Not every letter applies to every kind of element. This table keeps step 3 fast and complete:
| Element | S | T | R | I | D | E |
|---|---|---|---|---|---|---|
| External entity | yes | yes | ||||
| Process | yes | yes | yes | yes | yes | yes |
| Data store | yes | yes (logs) | yes | yes | ||
| Data flow | yes | yes | yes |
What to notice: processes attract all six, so the places where your extension decides or transforms something (a Function, a reaction) deserve the most time. External entities can be spoofed or can deny what they did; flows can be read, changed or blocked on the way.
The priority ladder
Section titled “The priority ladder”You will always find more threats than you can fix at once. The ladder decides the order. Judge three things for each threat: impact (which asset, how badly: money, safety, personal data, another module’s integrity), likelihood (who could do it and how easily: anyone on the internet, any holder of a credential, only a trusted insider, only by accident), and exposure (is it reachable from across a trust boundary?).
| Rung | When | What happens |
|---|---|---|
| P1 Block | Severe impact and reachable across a trust boundary, or by anyone who holds a credential | Fixed before go-live; the release does not ship with it open |
| P2 Fix before load | Serious impact but needs an insider, an unlikely condition, or is contained | Fixed before the capability carries real volume, in the first release |
| P3 Schedule | Limited impact, or a detective control already makes it visible | On the backlog with an owner and a date |
| P4 Accept | Residual risk the business chooses to carry | Written acceptance by the asset’s owner, with a review date |
What to notice: acceptance is a decision by the person who owns the asset, not by the reviewer, and it expires. A threat nobody has placed on the ladder is the only wrong answer.
Controls, and how to verify them
Section titled “Controls, and how to verify them”A control prevents (a grant that is never given, a secret checked on every post), limits (one credential per integration so a leak can be revoked alone; a cap on readings per minute) or detects (an alert when alarm thresholds are changed; a log line with the correlation id). Prefer prevention for P1, accept limitation or detection lower down.
Each control gets a verification: the check that would fail if the control were missing. For a grant, a write with that credential that must be refused. For a masked field, a read by a person without the grant that must show the mask. For a secret check, a post without the secret that must be rejected. For a log rule, a test reading followed by a search of the logs by its correlation id. Write the check next to the control, run it, and record the result and the date.
Where the threat model lives in the program
Section titled “Where the threat model lives in the program”A threat model is a program artefact, governed like the others you set up in M1-S2. Keep it beside the design it describes, under the same change control: a change request that adds a door (an integration, a public form, a new application user, an outbound call) is not complete until the model has a row for the new door. Give it an owner, usually the program’s master, and give each accepted risk the owner of the asset it puts at risk. Re-run the verifications at every promotion from Larkspur Dev to Larkspur Lab, because a grant or a secret that was right in one environment can be wrong in the next. And keep the history: when an incident happens, the first question is whether the threat was in the model, at what rung, and why.
Good to know. A threat model does not need special tooling. A diagram and a register with the columns element, STRIDE, class, what could happen, mark, rung, control, verification, result, date is enough, and it is what the capstone asks for. The threat-model card has the register’s header and the tables of this section on one page.
▶ Guided demo (10 min) — The planned capability on one page
Section titled “▶ Guided demo (10 min) — The planned capability on one page”Starting state. The pilot team’s design note says: the sensor simulator posts readings to the
platform’s API with an application user’s token; the platform stores them in Meter Readings; a
reaction compares each reading with its asset class’s Threshold Rules and, above the alarm level,
creates a Work Order and posts a copy to the CMMS; above the warning level it notifies the planner;
the reading-evaluator Function holds the comparison logic; planners maintain the thresholds.
- Draw the external entities and the edge. Sensors (through the simulator), the CMMS, planners and technicians are outside; the platform’s edge is the first process. The internet-to-edge line is the first trust boundary.
- Add the processes and stores inside. The alarm reaction, the Function (in its own runtime, so behind a second boundary), the four stores, and the run history and logs as stores.
- Add the flows and the third boundary. The outbound copy to the CMMS crosses from the platform to a system Larkspur does not run. The result:
flowchart LR
subgraph OUT["Outside: internet and plant network"]
SEN["Sensors and simulator"]
PLN["Planners and technicians"]
CMMS["CMMS receiver"]
end
subgraph PLAT["Larkspur Dev: behind the platform edge"]
EDGE["Platform edge<br/>authenticates every caller"]
RX["Alarm reaction"]
MR[("Meter Readings")]
TR[("Threshold Rules")]
WO[("Work Orders")]
LOG[("Run history and logs")]
end
subgraph FN["Function runtime"]
EVAL["reading-evaluator"]
end
SEN -- "reading + token" --> EDGE
PLN -- "sign-in session" --> EDGE
EDGE --> MR
PLN -. "edit thresholds" .-> TR
MR --> RX
RX <--> EVAL
TR --> EVAL
RX --> WO
RX --> LOG
EVAL --> LOG
RX -- "work-order copy" --> CMMS
What to notice: three boundaries, three subgraphs. Every flow that crosses one is a place to ask the STRIDE questions first: the reading coming in, the call into the Function runtime, and the copy going out to the CMMS.
-
Apply STRIDE to one flow and one process. The reading + token flow (T, I, D): can a reading be altered in transit (the API is reached over an encrypted connection, so not on the way), can it leak (it carries no personal data, if the design keeps it so), can the flow be flooded (yes: a stuck sensor; write it down). The reading-evaluator process (all six): its most credible threats are E (what credential does it act with?), I (what does it log?) and T (can anyone change its thresholds?).
-
Verify one foundation assumption live. The design assumes that nobody reaches Larkspur’s data without a credential. Check it: call the Work Orders list with no token at all.
Terminal window curl -s -o /dev/null -w "%{http_code}\n" "$BASE/api/v2/entities/work_orders/entries"The answer is
401: the platform refuses a caller with no credential, so spoofing at the platform’s door needs a stolen credential, and the credentials themselves become the assets to protect.
The demo stopped after one flow and one process on purpose. The lab completes the model, with the audit’s twelve findings as your evidence.
✓ Practice (4 min) — Check the method
Section titled “✓ Practice (4 min) — Check the method”In the Condition Monitoring diagram, where should the run history of the alarm reaction appear?
Check your answer
The correct answer is B. Open the explanation under each option to see why.
Which STRIDE categories do you examine for the flow that carries a work-order copy from the platform to the CMMS?
Check your answer
The correct answer is C. Open the explanation under each option to see why.
A threat can only be carried out by a trusted planner, and its damage is limited to one plant’s alarm thresholds, which are already reviewed weekly. Where does it most likely sit on the ladder?
Check your answer
The correct answer is B. Open the explanation under each option to see why.
⛏ Lab (50 min) — Triage the Larkspur findings set
Section titled “⛏ Lab (50 min) — Triage the Larkspur findings set”Goal. Complete the threat model of the planned Condition Monitoring capability, triage internal audit’s twelve findings against it, verify two of them on the running platform, and produce a ranked plan with a control and a verification for every finding you keep.
Before you start. Larkspur Dev, signed in as rami.aziz; a private window for Tariq Saleh
(tariq.saleh, password from your training provider); your terminal from the workbench, with the
CMMS stub’s address in $CMMS (export CMMS=<address>, from your enrolment message, as in M7-S2). The diagram from
the demo, copied into your notes.
The Larkspur findings set
Section titled “The Larkspur findings set”From: Larkspur Internal Audit. To: the program’s master. Subject: review of the Condition Monitoring pilot design (version 0.3) and of the current suite. Fictional; for this course only.
| Id | Finding as reported |
|---|---|
| LF-01 | The CMMS’s receiving address accepts any post and creates a work order from it. The pilot design sends nothing that would let the CMMS tell a post from the platform from anyone else’s. |
| LF-02 | The pilot’s telemetry application user, Larkspur Telemetry, is planned with Edit on the whole of Asset Maintenance. It only needs to add meter readings. |
| LF-03 | The reading-evaluator Function writes each incoming reading to its log in full. Readings from handheld meters carry the technician’s name and mobile number in their metadata. |
| LF-04 | Every member of Maintenance Planners can change the alarm and warning levels of every asset class. Changes are visible in the record’s history, but nobody is told of them. |
| LF-05 | When the API answers slowly, the sensor simulator retries the post. Two identical readings can be stored, and each can raise its own work order. |
| LF-06 | The pilot puts the CMMS’s API key in the address of the outbound call (…/work-orders?key=…). |
| LF-07 | The CMMS’s web page displays a work order’s description as formatted text. The description includes the technician’s free-text note. |
| LF-08 | To find the asset for a handheld reading, the Function builds a filter by joining the asset tag that the technician typed into a filter string. |
| LF-09 | The pilot adds a field Manufacturer bulletin address to Asset Classes. Each night the Function downloads that address to read the recommended thresholds. |
| LF-10 | Work orders raised by alarms are created by a reaction running as System. A work order does not say which reading or sensor caused it. |
| LF-11 | Nothing limits how many readings one sensor may post. In the pilot, one stuck sensor posted a reading every second for an afternoon. |
| LF-12 | Quality inspectors can read suppliers’ bank account numbers when they open a supplier. |
What to notice: an audit note mixes real threats, a reliability defect, duplicates of one weakness and claims that may not hold. Your job is not to accept the list but to triage it.
Complete the model
- Add to your diagram what the demo left out: the CMMS’s own web page (an external entity that displays what you send), the handheld meters as a second source of readings, and the Manufacturer bulletin address flow from LF-09. Mark which boundary each new flow crosses.
- For each finding, write in your threat register (one row each): the element it concerns, its STRIDE category, its vulnerability class from M5-S3 if it has one, and what could happen to which asset.
Verify two findings before you accept them
-
Verify LF-01. Post a fake work order to the CMMS stub with no credential at all:
Terminal window curl -s -o /dev/null -w "%{http_code}\n" -X POST "$CMMS/work-orders" \-H "content-type: application/json" -d '{"asset":"P-104","reason":"test from M5-S4"}'A
200or201means the receiver accepted a post that anyone could have sent: the finding is confirmed. -
Verify LF-12. In the private window, sign in as Tariq Saleh. Open Supplier Management › Suppliers in the portal and open Kestrel Seals. Look at Bank Account.
-
Record the result. If the value shows as
****, the finding is refuted: the field is protected for Procurement and Finance only (M5-S2), so the claim does not hold for the screen. Note one thing the screen check does not prove (any other path the value could travel), and keep that as a question rather than a finding. -
Sign Tariq out and close the private window.
Triage and rank
- Mark each finding confirmed, refuted, duplicate of another, or out of scope (a real defect that is not a security threat, handed to its owner). Give a one-line reason for each mark.
- Place every confirmed finding on the priority ladder, with impact, likelihood and exposure in a few words each.
- For each P1 and P2 finding, choose a control, say whether it prevents, limits or detects, and name the session where it will be built (M7 or M8 for the capability; M10 for the standard).
- For each P1 and P2 control, write its verification: the check that would fail if the control were missing.
- Add to the register the one threat the audit missed that your diagram shows (look at the flow into the Function runtime and at the run history store).
- Write a three-sentence summary a sponsor can act on: what blocks go-live, what must be fixed before load, and what is accepted and by whom.
Screenshot pending The Larkspur threat register in a spreadsheet: one row per finding with element, STRIDE, class, verification result, decision, rung, control and verification check What to notice: the register has a column for the verification result. LF-01 says “confirmed, 201 from the stub”, LF-12 says “refuted, masked for Tariq”: evidence, not opinion.
Check.
- Your diagram has at least three trust boundaries and includes the run history and logs as stores.
- Every one of the twelve findings has an element, a STRIDE category and a triage mark with a reason.
- LF-01 is marked confirmed from the stub’s answer, and LF-12 refuted from what Tariq saw.
- At least one finding is marked out of scope and handed to an owner, not silently dropped.
- Every confirmed finding has a rung on the ladder with impact, likelihood and exposure.
- Every P1 and P2 finding has a control and a verification check.
- You added one threat the audit did not report.
- Your summary names what blocks go-live.
Pass condition. The register covers all twelve findings, the two live verifications are recorded with their results, and every P1 finding has a preventive control and a check that would fail without it.
If something goes wrong
| What you see | What to do |
|---|---|
curl: (6) Could not resolve host for $CMMS | $CMMS is empty or mistyped. Copy the address from your enrolment message again and echo $CMMS. |
The stub answers 401 | You posted to /alarms, the capability’s address, which checks the receiver key (M7-S2). Post to /work-orders, the pilot’s address, or record LF-01 from the design note alone and say so. |
| Tariq cannot see Supplier Management at all | His grants differ from the seed. Reset the suite’s data with the seed’s --reset and try again; a missing menu is not evidence about the field. |
| Tariq sees a bank account number | Stop: the field’s protection is not as the seed defines it. Record LF-12 as confirmed, rank it P1 and tell your facilitator; it is a real finding in your environment. |
Model answer
Triage.
| Id | Element | STRIDE · class | Mark | Rung | Control (type) · built in | Verification |
|---|---|---|---|---|---|---|
| LF-01 | CMMS receiver (external) and the outbound flow | S · (missing authentication) | Confirmed (stub answered 201) | P1 | The CMMS issues a secret that the platform sends in a header on every post; the receiver rejects posts without it, and each post carries an idempotency key so a retried post changes nothing (prevent) · M7-S2 | A post to the capability’s /alarms address without the key header is refused with 401 (M7-S2) |
| LF-02 | Telemetry credential | E · broken access control | Confirmed (design note) | P1 | A dedicated user that can only create meter readings through one view, one per environment (prevent) · M7-S2 | A write to Work Orders with the telemetry token is refused with 403 |
| LF-03 | Function log (store) | I · secrets and personal data in logs | Confirmed | P2 | Log the reading’s id, asset and outcome only; drop contact metadata at intake (prevent) | Post a handheld test reading, search the logs by its correlation id: no phone number |
| LF-04 | Threshold Rules (store) | T, R | Confirmed | P3 | Notify the maintenance lead when an alarm level changes; history already attributes the change (detect) | Change a test threshold and see the notification |
| LF-05 | Reading flow | (reliability) | Out of scope as security; handed to M7’s idempotent retries | — | Idempotent posts with a client reference (owner: the capability’s builder) | — |
| LF-06 | Outbound flow and run history | I · secrets handling | Confirmed; same receiver as LF-01 but a separate weakness | P1 | Key in a header from configuration, redacted in run history (prevent) · M7-S2 | Inspect one run’s stored request: no key in the address or body |
| LF-07 | CMMS web page (external) | I, S in the receiver · cross-site scripting | Confirmed as a dependency | P2 | Send the note as plain text and record in the integration agreement that the CMMS shows it as text; the fix itself is the CMMS owner’s (limit) | Send a note containing markup and confirm the CMMS shows it literally |
| LF-08 | reading-evaluator | T, I · injection | Confirmed | P1 | Look the asset up with a structured criterion whose value is the tag, after validating its format (prevent) · M7-S1 | A tag containing filter syntax finds nothing and is logged as invalid |
| LF-09 | reading-evaluator and its outbound fetch | I, E · server-side request forgery | Confirmed | P1 | Remove the feature: bulletins are uploaded as files, nothing fetches a stored address (prevent) | No outbound fetch exists in the Function’s code or configuration |
| LF-10 | Alarm reaction | R | Confirmed | P3 | Each work order links to the reading that caused it, and the run keeps the reading’s correlation id (detect) | Open an alarm work order and follow its link to the reading |
| LF-11 | Reading flow and the reaction | D | Confirmed | P2 | At most one open alarm work order per asset and measure; a cap on readings per sensor per minute at the sender; an alert on reading volume (limit, detect) | Replay a stuck sensor: one work order, not hundreds |
| LF-12 | Suppliers (store) | I | Refuted (masked for Tariq) | — | None needed for the screen; open question: is the value ever copied into a payload or notification? | — |
The missed threat. The flow into the Function runtime: the Function acts with a credential, and if that credential is broader than reading thresholds and writing work orders, the Function becomes a confused deputy (E). Control: give it its own least-privilege credential and check it in M7-S1. (The run history store holding the CMMS key, before LF-06 is fixed, is an equally good answer.)
Summary for the sponsor. Go-live is blocked by five design defects: an unauthenticated CMMS receiver, an over-privileged telemetry account, a key in a URL, a filter built from typed text and a server that fetches addresses from records; all five are fixed in the build. Before the capability carries real volume, logs must stop carrying contact details, a stuck sensor must not flood the planners, and the CMMS must show notes as text. Threshold-change alerts and work-order traceability are scheduled for the first maintenance release, owned by the Maintenance Planner lead.
Resume point
Section titled “Resume point”Your triaged findings set is complete: this is the place to stop if you need to. The rest of the session (the discussion on fixing or accepting, the second practice and the recap) takes about 17 minutes, so start it when you can give it that long.
✳ Discussion (10 min) — Fix it, or accept it?
Section titled “✳ Discussion (10 min) — Fix it, or accept it?”The prompt. Omar Haddad says LF-11’s cap on readings per sensor will hide a genuinely failing pump that vibrates wildly: “I would rather get a hundred work orders than miss one.” (1) Is he right? What would you propose instead? (2) Who may decide to accept a residual risk on LF-11, and what must the acceptance say?
With a facilitator: pairs take opposite sides for 4 minutes (one argues for the cap, one for no cap), then the group agrees a design and an acceptance statement in 6 minutes. The facilitator writes the agreed acceptance on the board as a template.
On your own: write your answer to both prompts in a short paragraph each, then compare with the model answer.
Model answer
(1) Omar is right that a cap must never hide an alarm, and wrong that a flood is the only alternative. Separate readings from work orders: keep every reading (they are evidence), but let the rule open at most one alarm work order per asset and measure while one is open, adding later readings to it. The cap at the sender then protects the platform from a broken sensor without touching the alarm, and an alert on reading volume tells the planner that a sensor, not a pump, may be failing.
(2) Only the owner of the asset at risk may accept: here, the Operations Director for the availability of the maintenance plan, advised by the Maintenance Planner. The acceptance names the threat (LF-11), the residual risk (a sensor fault may produce many readings before the volume alert fires), the controls in place, the owner, and a review date, for example after the first month of production readings.
✓ Practice (6 min) — Threat-model decisions
Section titled “✓ Practice (6 min) — Threat-model decisions”A finding says: “The Work Orders view can be read by anyone.” You read it as rami.aziz and see it,
so you mark the finding confirmed. What was wrong with that verification?
Check your answer
The correct answer is B. Open the explanation under each option to see why.
Two findings are reported: an outbound call puts its key in the address, and the receiver accepts posts without any key. Why does the triage keep them as two findings rather than merging them?
Check your answer
The correct answer is A. Open the explanation under each option to see why.
For which threat is a detective control, rather than a preventive one, the reasonable first choice?
Check your answer
The correct answer is C. Open the explanation under each option to see why.
Halfway through the build, the team adds an option for suppliers to upload calibration certificates for the sensors. What does the method require?
Check your answer
The correct answer is B. Open the explanation under each option to see why.
The register shows LF-09 (a Function fetches a stored address) with the control “validate that the address starts with https”. Why is that control weak?
Check your answer
The correct answer is B. Open the explanation under each option to see why.
↺ Recap (1 min) — What you can now do
Section titled “↺ Recap (1 min) — What you can now do”You can threat-model a solution and its extensions with a method another master could check: scope and assets, a data-flow diagram with its trust boundaries, STRIDE applied per element, a rank on the priority ladder, a control for each threat above the line, and a verification that proves each control works. You can also triage someone else’s findings: confirm, refute, merge or hand on, and never accept a claim you have not checked. After Module 5 you can explain how identity and access are decided inside the platform, and threat-model a solution with its extensions.
Next. Module 6 opens the extension surfaces your controls will sit on: how Functions and webhooks behave inside (M6-S1), how packages carry a solution (M6-S2, M6-S3), and which extension point a need deserves (M6-S4). The P1 controls from your register are built into the capability in M7 or M8, and you threat-model your own capstone build in M11-S5 with the same card.