threat-model
A complete, worked threat model for a small checkout service. Use it as a template for shape and depth.
$ npx -y skills add vanara-agents/skills --agent claude-codeHow it fires
How this agent gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
Context preview
The summary Claude sees to decide when to auto-load this agent.
A complete, worked threat model for a small checkout service. Use it as a template for shape and depth.
Agent definition
threat-model.mdThreat Model — "QuickCheckout" Checkout Service
A complete, worked threat model for a small checkout service. Use it as a template for shape and depth.
1. Scope & assets
**In scope:** the public checkout API, its auth, the orders and session stores, and the Stripe integration. **Out of scope:** the marketing site, internal analytics pipeline.
**Assets (ranked):** 1. Customers' stored payment method tokens and order/PII data — highest value. 2. Account credentials / session tokens. 3. Integrity of order and refund records (financial correctness). 4. Service availability during a sale.
**Adversaries:** unauthenticated external attacker; authenticated malicious customer (abuse/IDOR); compromised third-party JS dependency; opportunistic bot networks.
2. Data-flow diagram
TRUST BOUNDARY: Internet ││ Private network
(E1) Browser ──1: POST /login──────────►││──► (P2) Auth Service ──3: read/write──►││──► (DS3) User DB
│ ││ │ ││
│ ││ └──4: read/write session──────►││──► (DS4) Session Cache
│ ││
└──2: POST /checkout (JWT)─────────►││──► (P5) Order API ──6: SQL────────────►││──► (DS6) Orders DB
││ │
││ ├──7: append──────────────────►││──► (DS7) Audit Log
││ │
││ └──8: POST /charge─────────────►││──► (E8) Stripe API
Legend: (E)=external entity (P)=process (DS)=data store N: flow ││ = trust boundary3. STRIDE threat table
| ID | Element | STRIDE | Threat | L | I | Sev | Decision |
|-----|----------------------|--------|-------------------------------------------------|---|---|-----|-----------|
| T1 | (2) /checkout flow | T | SQL injection via cart item id into Orders DB | 3 | 3 | 9 | Mitigate |
| T2 | (P2) Auth Service | S | Credential stuffing against /login | 3 | 2 | 6 | Mitigate |
| T3 | (2) /checkout (JWT) | E | IDOR: user A submits order referencing user B | 3 | 3 | 9 | Mitigate |
| T4 | (DS4) Session Cache | I | Session tokens readable in Redis at rest | 2 | 3 | 6 | Mitigate |
| T5 | (DS7) Audit Log | R | User disputes refund; log row is editable | 2 | 2 | 4 | Mitigate |
| T6 | (8) Stripe flow | I | Card data passes through our server unnecessarily| 2 | 3 | 6 | Avoid |
| T7 | (P5) Order API | D | Checkout flood exhausts DB connection pool | 2 | 2 | 4 | Mitigate |
| T8 | (E1) Browser | T | Compromised third-party JS skims card form | 2 | 3 | 6 | Mitigate |
| T9 | (P2) Auth Service | I | Verbose error reveals which emails are registered| 2 | 1 | 2 | Mitigate |
4. Mitigations
| Threat | Control | Verify by |
|--------|----------------------------------------------------------------------|--------------------------------------------|
| T1 | Parameterized queries only; reject non-ULID item ids at boundary | Static check + injection test in CI |
| T2 | Per-account + per-IP rate limit, lockout, MFA option | Load test login; assert 429 after N tries |
| T3 | Server-side ownership check: order.user_id == token.sub on every read | Authz test: user A cannot fetch B's order |
| T4 | Encrypt session cache at rest; short TTL; rotate on privilege change | Confirm KMS-backed encryption; TTL config |
| T5 | Append-only audit store; logs outside app write path; signed rows | Attempt UPDATE on audit row → denied |
| T7 | Bounded conn pool + per-key rate limit + queue with back-pressure | Stress test; assert graceful 429, no crash |
| T8 | Use Stripe-hosted fields/iframe; SRI on third-party scripts; CSP | CSP report-only in staging; SRI hashes set |
| T9 | Generic "invalid credentials" response; constant-time compare | Test login with unknown vs known email |
5. Accepted / transferred risks
- **T6 (avoided):** card data will never transit our servers — we use Stripe Elements so the browser
posts card details directly to Stripe. This *avoids* the threat (and most PCI scope) rather than mitigating it. Owner: Payments lead.
- **Volumetric DDoS at the network layer:** transferred to the CDN/WAF provider; accepted residual risk
of brief degradation during an extreme flood. Owner: SRE on-call.
6. Top risks & riskiest assumption
**Fix before launch:** T1 (SQLi, sev 9), T3 (IDOR, sev 9), then T2 (credential stuffing, sev 6).
**Riskiest assumption to validate first:** that the JWT `sub` claim is validated server-side on *every* order read and write. If any handler trusts a client-supplied `user_id` instead, T3 is exploitable regardless of the other controls — verify this first.
Read more
Threat Model — "QuickCheckout" Checkout Service
A complete, worked threat model for a small checkout service. Use it as a template for shape and depth.
1. Scope & assets
**In scope:** the public checkout API, its auth, the orders and session stores, and the Stripe integration. **Out of scope:** the marketing site, internal analytics pipeline.
**Assets (ranked):** 1. Customers' stored payment method tokens and order/PII data — highest value. 2. Account credentials / session tokens. 3. Integrity of order and refund records (financial correctness). 4. Service availability during a sale.
**Adversaries:** unauthenticated external attacker; authenticated malicious customer (abuse/IDOR); compromised third-party JS dependency; opportunistic bot networks.
2. Data-flow diagram
TRUST BOUNDARY: Internet ││ Private network
(E1) Browser ──1: POST /login──────────►││──► (P2) Auth Service ──3: read/write──►││──► (DS3) User DB
│ ││ │ ││
│ ││ └──4: read/write session──────►││──► (DS4) Session Cache
│ ││
└──2: POST /checkout (JWT)─────────►││──► (P5) Order API ──6: SQL────────────►││──► (DS6) Orders DB
││ │
││ ├──7: append──────────────────►││──► (DS7) Audit Log
││ │
││ └──8: POST /charge─────────────►││──► (E8) Stripe API
Legend: (E)=external entity (P)=process (DS)=data store N: flow ││ = trust boundary3. STRIDE threat table
| ID | Element | STRIDE | Threat | L | I | Sev | Decision | |-----|----------------------|--------|-------------------------------------------------|---|---|-----|-----------| | T1 | (2) /checkout flow | T | SQL injection via cart item id into Orders DB | 3 | 3 | 9 | Mitigate | | T2 | (P2) Auth Service | S | Credential stuffing against /login | 3 | 2 | 6 | Mitigate | | T3 | (2) /checkout (JWT) | E | IDOR: user A submits order referencing user B | 3 | 3 | 9 | Mitigate | | T4 | (DS4) Session Cache | I | Session tokens readable in Redis at rest | 2 | 3 | 6 | Mitigate | | T5 | (DS7) Audit Log | R | User disputes refund; log row is editable | 2 | 2 | 4 | Mitigate | | T6 | (8) Stripe flow | I | Card data passes through our server unnecessarily| 2 | 3 | 6 | Avoid | | T7 | (P5) Order API | D | Checkout flood exhausts DB connection pool | 2 | 2 | 4 | Mitigate | | T8 | (E1) Browser | T | Compromised third-party JS skims card form | 2 | 3 | 6 | Mitigate | | T9 | (P2) Auth Service | I | Verbose error reveals which emails are registered| 2 | 1 | 2 | Mitigate |
4. Mitigations
| Threat | Control | Verify by | |--------|----------------------------------------------------------------------|--------------------------------------------| | T1 | Parameterized queries only; reject non-ULID item ids at boundary | Static check + injection test in CI | | T2 | Per-account + per-IP rate limit, lockout, MFA option | Load test login; assert 429 after N tries | | T3 | Server-side ownership check: order.user_id == token.sub on every read | Authz test: user A cannot fetch B's order | | T4 | Encrypt session cache at rest; short TTL; rotate on privilege change | Confirm KMS-backed encryption; TTL config | | T5 | Append-only audit store; logs outside app write path; signed rows | Attempt UPDATE on audit row → denied | | T7 | Bounded conn pool + per-key rate limit + queue with back-pressure | Stress test; assert graceful 429, no crash | | T8 | Use Stripe-hosted fields/iframe; SRI on third-party scripts; CSP | CSP report-only in staging; SRI hashes set | | T9 | Generic "invalid credentials" response; constant-time compare | Test login with unknown vs known email |
5. Accepted / transferred risks
- **T6 (avoided):** card data will never transit our servers — we use Stripe Elements so the browser
posts card details directly to Stripe. This *avoids* the threat (and most PCI scope) rather than mitigating it. Owner: Payments lead.
- **Volumetric DDoS at the network layer:** transferred to the CDN/WAF provider; accepted residual risk
of brief degradation during an extreme flood. Owner: SRE on-call.
6. Top risks & riskiest assumption
**Fix before launch:** T1 (SQLi, sev 9), T3 (IDOR, sev 9), then T2 (credential stuffing, sev 6).
**Riskiest assumption to validate first:** that the JWT `sub` claim is validated server-side on *every* order read and write. If any handler trusts a client-supplied `user_id` instead, T3 is exploitable regardless of the other controls — verify this first.
🐒 Free agents, skills & packs for Claude Code One subscription. An army of Claude Code agents. 30 production-grade agents, skills, and packs for Claude Code — free, Apache-2.0, install with one command.
Repo: vanara-agents/skills
Other agents on vanara-agents-skills.
- AGENT
Use when designing a new HTTP/GraphQL API or changing an existing one — modeling resources, defining endpoint contracts, choosing status codes, pagination, filtering, error envelopes, versioning, and idempotency. Produces a reviewable API contract plus an OpenAPI snippet, not
Open agent - review-notes
This shows how the api-designer agent reviews a flawed draft. Findings are severity-ranked so the implementer fixes the contract-breakers first. Severity legend: **CRITICAL** (breaks clients / data risk), **HIGH** (real bug or inconsistency), **MEDIUM** (maintainability),
Open agent - contract-and-openapi
The contract is the deliverable. Express it as an **OpenAPI 3.1** document so it is human-readable *and* machine-checkable. This reference covers how to structure that document and what `scripts/lint-openapi.mjs` enforces.
Open agent - design-checklist
Run through this before declaring an API contract done. It is ordered the way you should *design*: resources first, cross-cutting rules last. Every box is a place real APIs go wrong in production.
Open agent - versioning-and-evolution
APIs are forever once published: a consumer you've never met may depend on any field you expose. Design so you can **add without breaking**, and version explicitly when you must break.
Open agent - pr-comment-template
Copy-paste templates for leaving review comments. Keep each comment to one finding: an anchor, the problem, and the fix.
Open agent

