| name | threat-modeling |
| description | Performs data flow threat analysis with structured mitigations. Use when assessing security threats for new features, architecture changes, or compliance reviews. |
| argument-hint | [optional: --quick] |
Threat Modeling
Reference
- ID: S-RISK-01
- Category: Risk
- Inputs: system architecture, data flow diagrams, trust boundaries, asset inventory
- Outputs: threat model document → artifacts/risk/
- Used by: Ops & Risk Agent
- Tool scripts: ./tools/artifact/validate.sh
Purpose
Produces a structured threat model that identifies attack surfaces, enumerates threats using a systematic methodology (STRIDE), and maps each threat to concrete mitigations, ensuring security is considered proactively rather than reactively.
Procedure
Step 0: Stage-Aware Mode Selection
Read company.stage from company.config.yaml. If idea or mvp:
MVP Security Checklist (use instead of full STRIDE):
- Auth provider (not roll-your-own)
- HTTPS enforced
- Input sanitization on all user-supplied fields
- Payment webhook signature verification (if applicable)
- No secrets in code (run
./tools/security/secrets-scan.sh)
- Dependency scanning configured
Reserve full STRIDE analysis for growth/scale stages or features touching financial data/PII at scale. If user passes --quick, always use MVP mode regardless of stage.
- Define the scope: which system, feature, or data flow is being modeled.
- Draw or review the data flow diagram (DFD): external entities, processes, data stores, data flows. Use the excalidraw skill (S-ENG-17) to produce the DFD — Mermaid
flowchart LR with trust boundary subgraphs inline, and optionally an Excalidraw file for richer documentation.
- Identify trust boundaries: where data crosses between trust zones.
- Enumerate threats using STRIDE (Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of Privilege) for each element.
- Rate each threat: likelihood (1-5) and impact (1-5), calculate risk score.
- For each threat, define a mitigation: preventive control, detective control, or accepted risk.
- Prioritize mitigations by risk score.
- Document residual risks: threats accepted without full mitigation.
- Define review triggers: when this threat model should be revisited.
- Save the threat model to
artifacts/risk/.
- Validate the artifact using
./tools/artifact/validate.sh.
Cross-References
- security-posture (S-RISK-04) — aggregate view of all threat model findings across features; run
/security-posture for cross-cutting risk inventory
- release-readiness-gate (S-QA-03) — consumes threat model as a required artifact for Bar 3 (Security & Risk)
Quality Checklist