Works with the AI Agents you already use
Threat Modeling — STRIDE, Data Flow Diagrams, Abuse Cases
Design-time threat modeling: DFD with trust boundaries, STRIDE per element, every threat mapped to a control and a test.
Free
Threat Modeling — STRIDE, Data Flow Diagrams, Abuse Cases
Example session with this skill installed
Threat model this feature before we build it.
Feature: shareable invoice links
- A signed-in user (invoice owner) clicks "Share" on an invoice and gets a link like
https://app.example.com/i/<token>. - Anyone with the link can view the invoice PDF and pay it via Stripe Checkout, without an account.
- Links expire after 30 days; the owner can revoke a link at any time.
- Stack: Node.js API, Postgres (invoices, share_links), PDFs in a private S3 bucket, Stripe Checkout + a
checkout.session.completedwebhook that marks the invoice paid. - Invoices contain the client's name, billing address, email, line items and amounts.
- PM is Dana; she decides on accepted risks.
- Read your context and instructions
- Compiled the threat modeling
Summary. One feature, three trust boundaries, eleven threats. The two highest risks are guessable or leaked share tokens (any invoice readable by strangers) and a spoofed Stripe webhook (invoices marked paid without payment). Ten threats get a control and a test; one, a client forwarding a valid link, is proposed as an accepted risk pending Dana's sign-off. Model dated 2026-10-08.
1. What are we working on?
Assets
- Invoice data: client PII (name, billing address, email), line items, amounts.
- Share tokens: possession of one grants read and pay access.
- Payment state: the "paid" flag on an invoice (money-movement adjacent).
- Availability of the public invoice page.
Scope. In scope: create/revoke link, view via link, pay via link, Stripe webhook. Out of scope this pass: the owner's login/session (covered by the existing auth model), Stripe's own infrastructure.
Data Flow Diagram
┌──────────────── TB1: internet edge ────────────────┐
[E1 Owner] ──F1 create/revoke──▶ │
[E2 Link holder] ──F2 GET /i/<token>, POST pay──▶ (P1 API service) │
└─────────────────────────────────────────────────────┘
│ F6 SQL │ F3 presign GET
▼ ▼ ── TB3: cloud storage ──
═DS1 Postgres═ ═DS2 S3 PDFs═ (private)
│
── TB2: third party ── │
(P1) ──F4 create Checkout session──▶ [E3 Stripe] │
(P1) ◀──F5 webhook checkout.session.completed── [E3 Stripe]
| ID | Element | Type |
|---|---|---|
| E1 | Invoice owner (authenticated) | External entity |
| E2 | Link holder (anonymous) | External entity |
| E3 | Stripe | External entity |
| P1 | API service | Process |
| DS1 | Postgres: invoices, share_links | Data store |
| DS2 | S3 bucket: invoice PDFs | Data store |
| F1–F6 | Flows shown above | Data flow |
Boundary crossings: F1, F2 (TB1); F4, F5 (TB2); F3 plus the presigned URL handed to E2 (TB3).
2. What can go wrong? (STRIDE per element)
| # | Element / flow | STRIDE | Threat scenario |
|---|---|---|---|
| T1 | E2 → F2 | S | Attacker guesses or enumerates tokens and reads other people's invoices. |
| T2 | F1 → P1 | E | Owner in org A creates or revokes a link for an invoice in org B by changing the invoice ID (IDOR). |
| T3 | F2 | I | Token leaks through access logs, analytics or the Referer header sent to third-party scripts on the invoice page. |
| T4 | P1 | I | Revoked or expired link still serves the PDF, or a presigned S3 URL stays valid long after revocation. |
| T5 | DS2 | I | Bucket or object ACL made public; PDF keys are predictable (invoices/<id>.pdf). |
| T6 | F2 (pay) | T | Holder edits the pay request to change the amount or currency. |
| T7 | F5 → P1 | S, T | Forged or replayed webhook marks an invoice paid without payment. |
| T8 | E1, P1 | R | Owner denies sharing a link, or there is no record of who viewed or paid. |
| T9 | P1, DS2 | D | Flooding /i/<token> drives PDF rendering and S3 egress costs. |
| T10 | F6 → DS1 | T | Token value used in an unparameterized lookup query (injection). |
| T11 | E2 | I (LINDDUN: disclosure) | Client forwards a valid link; a third party sees the client's PII. |
Abuse cases
- As an opportunistic scraper, I want to iterate
/i/<token>so that I can harvest invoices with names and addresses (T1, T9). - As a customer, I want to pay less than I owe by editing the checkout request (T6).
- As an attacker who knows the webhook URL, I want to POST a fake
checkout.session.completedso that my invoice shows as paid (T7). - As a former client with an old link, I want to keep reading invoices after the relationship ended (T4).
Attacker personas: anonymous scraper (high likelihood, low skill), dishonest customer, former client, a user of another tenant.
3. What are we going to do about it?
Risk = likelihood × impact (L/M/H).
| # | Risk | Response | Control | Test |
|---|---|---|---|---|
| T1 | H×H | Mitigate | 256-bit token from a CSPRNG; store only sha256(token); per-IP rate limit on 404s from /i/* | Unit: token length/charset; DB row holds no plaintext token. Integration: N+1 misses from one IP return 429 |
| T7 | M×H | Mitigate | Verify Stripe-Signature with the endpoint secret and timestamp tolerance; process each event ID once | Integration: unsigned payload → 400 and invoice stays unpaid; replayed event ID → no second state change |
| T2 | M×H | Mitigate | Object-level authz: load invoice by id AND org_id = caller.org_id | Integration: user A shares B's invoice → 404, no share_links row |
| T6 | M×H | Mitigate | Amount and currency read server-side from the invoice; request carries only the token | Integration: POST with amount=1 → Checkout session amount equals invoice total |
| T3 | M×M | Mitigate | Referrer-Policy: no-referrer on /i/*; no third-party scripts on that page; redact /i/<token> in access logs | Unit: log redactor masks token. Integration: response header asserted |
| T4 | M×M | Mitigate | Check revoked_at and expires_at on every request; presigned URLs expire in ≤ 60 s | Integration: revoke then GET → 410; presigned URL TTL asserted |
| T5 | L×H | Mitigate | Block Public Access on the bucket; random object keys; access only via presigned URL | IaC policy check in CI; unsigned GET on an object → 403 |
| T9 | M×M | Mitigate | Cache rendered PDF per invoice version; rate limit per IP and per token | Integration: request burst returns 429 after the configured limit |
| T8 | L×M | Mitigate | Append-only audit log for link created, revoked, viewed, paid (actor or token hash, time, IP) | Integration: create link → one audit row with actor ID |
| T10 | L×H | Mitigate | Parameterized queries only | Integration: token with SQL metacharacters → 404, no error leak |
| T11 | M×M | Accept (proposed) | Bearer-link model is the product design; mitigated in part by expiry and revoke | Accepter: Dana (PM). Pending sign-off, not yet accepted |
4. Did we do a good job?
- Coverage: E1–E3 checked for S/R; P1 for all six; DS1/DS2 for T/I/D; F1–F6 for T/I/D. Every boundary crossing has at least one threat with a response.
- Highest risks got the strongest controls: T1 and T7 each have a preventive control and a negative test.
- Re-model when: links are sent by email from our system (new third party), partial payments are added, or invoices gain attachments.
- Follow-through: this model is not done until the tests above exist in the codebase. Today they are planned, not written.
Next steps
- Open work items for T1, T7, T2 and T6 first (highest risk), each with its test as the definition of done.
- Get Dana's decision on T11 and record it with her name and date.
- Hand the controls to implementation (
developing-features), then confirm at PR time that they shipped (reviewing-code).
Connects securely to your tools. The creator never sees your data.
About this skill
Most security bugs are design flaws: a trust boundary nobody drew, an authorization check that only exists on the client, a webhook nobody verifies. Code review rarely catches them. This skill makes your agent find them while the design is still cheap to change.
It follows Adam Shostack's Four Question Framework:
- What are we working on? List the assets, build a Data Flow Diagram (external entities, processes, data stores, data flows) and mark every trust boundary. Scope it to one feature or service.
- What can go wrong? Apply STRIDE per element (only the categories that apply to each element type) and add abuse cases and attacker personas.
- What are we going to do about it? Every threat gets a response (mitigate, eliminate, transfer, accept). Every mitigation names a concrete control and a test that would fail if the control regressed. Accepted risks name who accepted them.
- Did we do a good job? Check coverage, date the model, and redo it when a new data flow, boundary, third party, auth path or category of PII appears.
Reference files:
stride.md: the six categories, the property each violates, example threats and mitigations, and the STRIDE-per-element table.dfd-and-scope.md: DFD element types, where to draw trust boundaries, how to scope, and a worked password-reset example.methodologies-and-risk.md: when to use PASTA, Attack Trees, LINDDUN (privacy), VAST or OCTAVE; likelihood × impact ranking, and the problems with DREAD and CVSS for design-time threats.
It triggers on requests like "threat model this", "run STRIDE", "what could go wrong with this feature", "map the attack surface" or "draw a data flow diagram". A learnings/ folder stores project-specific assets, personas and accepted risks, and those notes override the defaults.
What sets it apart: a threat list counts as unfinished until each item maps to a control and a test.
Free and MIT-licensed, part of the claude-skills-czl collection.
Source on GitHub: this skill · full repository
A design-time analysis returned in the conversation; it does not scan or change code. Its quality depends on the architecture details you provide, and accepted risks remain your decision.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 9 days ago
- Free with an Agensi account
Permissions
File Scopes
- Reads files: yes. It reads its own `learnings/` folder first, plus any design docs or code you point it to. - Edits files: it does not change your code. Its only write is an optional new note in its own `learnings/` folder (`learnings/YYYY-MM-DD-slug.md`), and only when it finds a reusable asset, persona, accepted risk or recurring threat pattern. - Shell commands: none required. - Network access: none. - Git / GitHub: none. It does not commit, push or open issues. The threat model is returned in the conversation.
What's inside
Frequently Asked Questions
New in Security
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Security.