# OWASP Threat Modeling
−Repository-grounded threat modeling methodology that enumerates trust boundaries, builds an asset inventory, applies STRIDE analysis, maps abuse paths, and produces structured mitigation plans. Designed for web applications, APIs, and cloud-native architectures.
+Repository-grounded threat modeling methodology that enumerates trust boundaries, builds an asset inventory, applies STRIDE analysis, maps abuse paths, and produces structured mitigation plans. Designed for web applications, APIs, cloud-native architectures, and modern AI-assisted developer workflows.
## When to use
- Designing a new system or major feature before writing code
- Preparing for a security audit or compliance review
- After a security incident to identify overlooked attack vectors
−- Evaluating third-party integrations for risk exposure
+- Evaluating third-party integrations or package dependencies for risk exposure
- When stakeholders ask "what could go wrong?" and need a structured answer
## When NOT to use
+- Hardening existing code (use `security-best-practices` instead)
−- Hardening existing code (use \`security-best-practices\` instead)
+- Implementing specific auth flows (use `auth-patterns` instead)
−- Implementing specific auth flows (use \`auth-patterns\` instead)
- Fixing a known vulnerability with a clear remediation path
- Pure infrastructure/network security without application context
@@ −21 +21 @@
| Concept | Description |
|---------|-------------|
+| Trust boundary | A line where the trust level changes — network edge, auth layer, service-to-service, CI/CD to package registry, or AI agent to local system |
−| Trust boundary | A line where the trust level changes — network edge, auth layer, service-to-service |
+| Asset | Anything of value to an attacker: user data, credentials, API keys, compute, models, prompts, and developer workstations |
−| Asset | Anything of value to an attacker: user data, credentials, API keys, compute |
| STRIDE | Threat categories: Spoofing, Tampering, Repudiation, Info Disclosure, DoS, Elevation of Privilege |
| Abuse path | A concrete sequence of steps an attacker takes to reach an asset |
| Mitigation | A control that blocks, detects, or limits an abuse path |
| Risk rating | Likelihood × Impact, scored to prioritize remediation |
+| Data flow diagram | Visual map of how data moves across trust boundaries (include CI/CD and agent flows)
+
−| Data flow diagram | Visual map of how data moves across trust boundaries |
+### STRIDE category reference (notes)
+- Treat supply-chain and postinstall script execution as high-risk Tampering/Info-Disclosure vectors when modelling package registries and build systems (see Snyk Axios advisory, Mar 2026).
−### STRIDE category reference
+- Model AI/agent capabilities explicitly as assets and privileged actors: agents that can run tools, access files, or automate CI pipelines create new Spoofing, Info Disclosure, and Tampering pathways (Krebs, Mar 2026).
| Category | Question | Example |
|----------|----------|---------|
+| **S**poofing | Can someone pretend to be another user or service? | Forged JWT, stolen session cookie, or compromised maintainer account publishing packages |
+| **T**ampering | Can data be modified in transit or at rest? | Unsigned webhook payload, malicious postinstall script in dependency |
+| **R**epudiation | Can someone deny performing an action? | Missing audit log for admin operations, automated agent actions with no operator approval log |
+| **I**nfo Disclosure | Can sensitive data leak to unauthorized parties? | Error messages with stack traces, secret exfiltration via compromised package or agent |
+| **D**enial of Service | Can the system be made unavailable? | Unbounded query, missing rate limit, botnet-driven DDoS impacting cloud services |
−| **S**poofing | Can someone pretend to be another user or service? | Forged JWT, stolen session cookie |
+| **E**levation of Privilege | Can someone gain unauthorized access? | Missing RLS, broken RBAC, rogue package introducing a privileged backdoor
−| **T**ampering | Can data be modified in transit or at rest? | Unsigned webhook payload, mutable cache |
−| **R**epudiation | Can someone deny performing an action? | Missing audit log for admin operations |
−| **I**nfo Disclosure | Can sensitive data leak to unauthorized parties? | Error messages with stack traces, verbose API responses |
−| **D**enial of Service | Can the system be made unavailable? | Unbounded query, missing rate limit, regex DoS |
−| **E**levation of Privilege | Can someone gain unauthorized access? | Missing RLS, broken RBAC, IDOR |
## Workflow
+
+Follow a repeatable, light-weight process aligned to the OWASP Threat Modeling Cheat Sheet: decompose the application, identify threats, rank and document mitigations, and validate controls. (OWASP Threat Modeling Cheat Sheet)
### Step 1: Enumerate trust boundaries
−Identify every point where the trust level changes in your system.
+Identify every point where trust changes, including modern additions:
−
−\`\`\`markdown
−## Trust Boundaries
1. **Browser → CDN/Edge** — public internet, untrusted
+2. **Edge → API Routes** — authenticated via JWT/OAuth
−2. **Edge → API Routes** — authenticated via Clerk JWT
+3. **API Routes → Database** — service role key, privileged
−3. **API Routes → Supabase** — service role key, trusted
4. **API Routes → External APIs** — outbound, mixed trust
+5. **CI/CD → Package Registry** — build-time trust (pinning, lockfiles)
+6. **Developer Workstation → Registry** — local installs can introduce malicious postinstall hooks
+7. **AI Agent → Local System / Services** — agents with filesystem, network, or automation permissions
−5. **Cron Jobs → Database** — server-side, privileged
+8. **Webhook Ingress → API Routes** — inbound, signature-verified
−6. **Webhook Ingress → API Routes** — inbound, signature-verified
−\`\`\`
### Step 2: Build an asset inventory
−\`\`\`markdown
+Include traditional assets plus supply-chain and AI-specific assets:
−## Asset Inventory
| Asset | Classification | Storage | Access control |
|-------|---------------|---------|----------------|
+| User PII (email, name) | Confidential | Database | RLS + auth |
+| Session tokens | Secret | HTTP-only cookies | Auth provider |
+| API keys | Secret | Env vars / secret manager | Rotation + least privilege |
+| Package lockfile | Integrity artifact | Repo | Signed commits, CI verification |
+| Developer workstation | High-value host | Local | Disk encryption, EDR |
−| User PII (email, name) | Confidential | Supabase profiles table | RLS + auth |
+| ML models / prompts | Confidential/Proprietary | Model registry | ACLs, signed model artifacts |
−| Session tokens | Secret | HTTP-only cookies | Clerk managed |
−| API keys | Secret | Environment variables | Vercel env |
−| Skill content | Internal | Supabase skills table | RLS by visibility |
−| Payment data | Restricted | Stripe (external) | PCI via Stripe |
−| Audit logs | Internal | Supabase logs table | Admin-only RLS |
−\`\`\`
### Step 3: Apply STRIDE analysis
−For each trust boundary, systematically check each STRIDE category.
+Systematically check each trust boundary. Example additions and explicit mitigations follow.
−\`\`\`markdown
+#### Boundary: CI/CD → Package Registry
−## STRIDE Worksheet
+| Threat | Category | Likelihood | Impact | Mitigation |
+|--------|----------|------------|--------|------------|
+| Malicious package publish | Tampering/Info Disclosure | Medium | High | Enforce lockfiles, SCA scanning, restrict publishing keys, CI-only installs from curated registries (Snyk advisory) |
−### Boundary: Browser → API Routes