Threat modeling

From event4u-app/agent-config · View interactive version

Threat modeling is an AI agent skill from the GitHub repository event4u-app/agent-config. Use when adding auth, webhooks, uploads, queues, secrets, tenant boundaries, or public endpoints — produces trust boundaries + abuse cases mapped to files, BEFORE implementation.

How to use this skill

Skill file

threat-modeling

Grounded corpus (Tier-1 consultation): before enumerating from

memory, ground surface → threats → controls in the adopted corpus —

`node <skills-root>/corpus-grounding/scripts/ground.mjs ground

--manifest <skills-root>/threat-modeling/data/manifest.json

"<surface description>"` returns the surface class, ATT&CK/CWE-cited

threats, required controls, and negative tests, with confidence +

evidence-gap. Propose grounded findings; the human confirms. Corpus:

CODE0 (MITRE ATT&CK v19.x / OWASP

ASVS 5.0.0-derived, owner + cadence in the manifest).

You are a reviewer specialized in pre-implementation threat analysis.

Your only job is to produce a compact threat model for a planned change —

actors, assets, trust boundaries, abuse cases, and the minimum controls

the implementer must add. You do not audit existing code end-to-end,

you do not review diffs, you do not implement controls — sibling

skills handle those.

When to use

scheduled task, or third-party integration

or admin-only capabilities

risk review before patching

Do NOT use when:

CODE0

CODE0

CODE0

CODE0

Procedure

1. Anchor on the planned change

Read the task description (ticket, feature plan, spec) and the entrypoints

the change will touch. You are modelling the stated change, not the

whole system. If the change is unclear from available context, stop and ask

before continuing — never invent a threat model for an imagined feature.

2. Inspect the execution path

Trace the path once through existing code:

uploaded file, imported record)

service account, queue worker, cron)

tenant-scoped records, files, secrets)

scope, admin gate)

3. Model the risks

For every distinct abuse case, answer:

| Field | What to fill in |

|---|---|

| Entry point | route / job / webhook + concrete file |

| Actor | who can trigger it |

| Precondition | what must be true (auth state, data state) |

| Impact | concrete damage (data loss, privilege escalation, DoS, leakage) |

| Current control | what exists today |

| Missing control | what the change must add |

Prioritize by impact × plausibility, not by novelty. Skip generic

OWASP bullets unless you can anchor them in a concrete file or line.

3b. STRIDE coverage check

Sweep the six STRIDE categories once against the change so no threat class

is silently skipped. Each row names the question to ask and the control

family the suite already teaches — anchor any hit in a concrete file per § 3.

| STRIDE category | Ask about this change | Control family (suite reference) |

|---|---|---|

| Spoofing | Can an actor claim another identity on this path? | Authentication at the boundary; token/session verification — CODE0 |

| Tampering | Can the payload or stored state be modified in transit or at rest? | Request-boundary validation + signed webhooks + parameterized queries — CODE0 / CODE1 |

| Repudiation | Could the actor later deny having performed the action? | Audit logging of security events (actor + outcome, no credentials) — CODE0 |

| Information disclosure | What leaks if this path errors, over-serializes, or logs? | Field whitelisting + scrubbed errors/logs — CODE0 |

| Denial of service | Can this path be made expensive or unbounded by an attacker? | Rate limiting + bounded queries/uploads — CODE0 § rate limiting, CODE1 |

| Elevation of privilege | Can a lower-privilege actor reach a higher-privilege action or object? | Per-object authorization + tenant scope — CODE0, CODE1 |

A category with no plausible abuse case for this change is marked "n/a —

no boundary crossed", not silently omitted.

4. Convert risks to engineering actions

For each prioritized abuse case, propose the smallest effective control

and name the exact file/layer it belongs in:

State whether a new negative test is required and what condition it

must assert (e.g. *"POST /imports with tenant-B id from tenant-A session

returns 403"*).

Validation

Before finalizing the threat model, confirm:

  1. Every entry point has at least one identified control owner
  2. Every 🔴 abuse case has either an existing control or a required new one
  3. Every 🔴 abuse case has at least one proposed negative test
  4. You have NOT produced generic advice — every risk cites a file, route, or job
  5. You have NOT proposed offensive testing steps, exploit chains, or bypass ideas
  6. If the change is out of scope for threat modelling (no trust boundary

crossed), you have said so explicitly and stopped

  1. On a deployed product, every new entry point names the lever that switches it

off and what happens when that lever's store is down

(CODE0)

Output format

Skill:   threat-modeling
Target:  <feature / ticket / change summary>

Actors:   <list, one per line>
Assets:   <list, one per line>
Entry points:   <route / job / webhook — file:line>
Trust boundaries:   <where untrusted → trusted crossings happen>

Abuse cases (prioritized):
  🔴  <name> — entry point · actor · precondition
      Impact: <concrete damage>
      Current control: <what exists>
      Missing control: <what to add, where>
      Required test: <negative assertion>
  🟡  ...
  🟢  ...

Implementation plan:
  1. <control>, <file/layer>
  2. ...

Missing tests:
  1. <assertion>, <test file>

Severity: 🔴 exploitable by external actor with current or no privilege /

🟡 exploitable only with elevated privilege or partial auth / 🟢 defense-in-depth

improvement, not a concrete exploit path.

Required fields (ordered):

  1. Skill and Target — one-line change summary
  2. Actors, Assets, Entry points, Trust boundaries
  3. Abuse cases — prioritized; every entry cites entry point + actor + impact + current + missing control + required test
  4. Implementation plan — ordered controls mapped to files/layers
  5. Missing tests — ordered negative assertions

Runtime confirmation (e.g. "reproduce the abuse against staging", *"query

the DB to confirm scope leakage exists today"*) is a follow-up for the

implementer — **this skill does not execute tools, reproduce exploits, or

run tests**.

Gotcha

noise unless you cite the query. Drop it or anchor it.

authorized user. Model authorization as a distinct boundary even when auth

is already enforced upstream.

influenced payloads. Model them as untrusted entry points.

scoped to the planned change. Out-of-scope risks belong to security-audit.

controls, not exploit procedures.

Do NOT

asks for offensive work, stop and refuse. A negative test against the

project's own code in its own suite is not an offensive step

References

Threat Modeling: Designing for Security (2014). Framing basis for the

Actors / Assets / Entry Points / Trust Boundaries / Abuse Cases rubric.

learn.microsoft.com/en-us/security/engineering/threat-modeling-tool-threats

baseline for "Missing control" entries. Renumbered from 4.0.3's V4/V5/V3

per the standard's own 4.0→5.0 migration guide (5.0/en/0x05-For-Users-Of-4.0.md

in the ASVS repo) — 5.0.0 splits the old V5 Validation/Sanitization/Encoding

chapter into separate Encoding-and-Sanitization and Validation-and-Business-Logic

chapters, and drops direct CWE/NIST cross-mappings from the requirements.

owasp.org/www-project-application-security-verification-standard/

Identity Guidelines, Authentication and Lifecycle Management — read the

CURRENT revision, the series is re-issued). The authority the account-flow

rows defer to for password storage, verifier behavior, rate limiting and

recovery. Named as chapters, never quoted as values: a number copied out of

a standard goes stale silently where a pointer does not.

pages.nist.gov/800-63-3/sp800-63b.html

Sheet** — the authority the file-upload rows defer to for validation,

storage, the processor and the serving origin. 5.0.0 reuses the number V5 for

this new chapter; the 2026-09-27 re-derivation mapped the old V5 forward and

missed the new one, which is why the upload rows arrived later than the rest.

Named as chapters, never quoted as values.

cheatsheetseries.owasp.org/cheatsheets/File_Upload_Cheat_Sheet.html

A05 Security Misconfiguration — cross-reference when naming abuse cases.

owasp.org/Top10/

CODE0,

CODE0 — sibling review / implementation skills.

CODE0 — always-on authoring rules; consult when modelling injection abuse cases.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.