SKILL.md
Application threat modeler
An evidence-first workflow to map assets, trust boundaries, attacker capabilities, and abuse paths for a concrete change.
- Revision
- 2
- Verified
- 2026-10-20
Compatibility and paths
Codex
skills/threat-model/SKILL.mdClaude Code
.claude/skills/threat-model/SKILL.mdVS Code
.github/skills/threat-model/SKILL.mdTrust and provenance
Curated record reviewed 2026-10-20. Results still depend on the supplied context and target environment.
Generated assetReady to copy or download
---
name: threat-model
description: Builds a versioned threat model from named actors, flows, assets and control evidence. Use during a concrete feature design; separate a documented risky capability, a plausible abuse path and a missing implementation fact.
license: CC-BY-4.0
compatibility: Worked case is a complete fictional design, not a target to scan. Optional inventory validation uses Node.js 22.13+ only. Real system verification requires an owner-approved scope and environment.
metadata:
author: oneliners
version: "2.0.0"
---
# Application threat modeler
## Frame the decision and attacker capabilities
Ask which feature/revision is being approved, what must remain confidential/correct/available, and who can influence which inputs. Name external actors, service identities, stores and network boundaries. Separate the design's assertions from code, deployment policy and observed controls. An architecture document is not execution evidence.
## Complete preview-service design input
This original fictional case includes all supplied facts. "Not supplied" means unknown, not disabled. The API authenticates editors and derives the tenant; the worker and result lookup still have independent trust obligations. Flow IDs keep each claim traceable.
```json
{
"revision": "preview-design-3 (fictional, not OneLiners)",
"purpose": "A tenant editor asks for a thumbnail of a public URL, then retrieves that editor's tenant-scoped result.",
"nodes": [
"browser",
"api",
"queue",
"worker",
"origin",
"artifact-store",
"result-api"
],
"flows": [
{
"id": "F1",
"from": "browser",
"to": "api",
"data": "URL supplied by editor; API verifies session and derives tenant from it"
},
{
"id": "F2",
"from": "api",
"to": "queue",
"data": "job ID, server-derived tenant and unchanged URL"
},
{
"id": "F3",
"from": "queue",
"to": "worker",
"data": "private queue message; worker follows URL redirects"
},
{
"id": "F4",
"from": "worker",
"to": "origin",
"data": "outbound fetch; destination DNS/address/egress enforcement not supplied"
},
{
"id": "F5",
"from": "worker",
"to": "artifact-store",
"data": "thumbnail stored under server job/tenant key; raw content retention unknown"
},
{
"id": "F6",
"from": "result-api",
"to": "artifact-store",
"data": "lookup by caller-supplied job ID; tenant authorization code not supplied"
}
],
"controls": {
"apiScheme": "HTTP/HTTPS only",
"redirects": "followed",
"destinationRestriction": "not supplied",
"workerIdentity": "not supplied",
"outputEncoding": "HTML escaping documented",
"fetchTimeLimit": "2 seconds documented, not execution-verified",
"responseByteLimit": "not supplied",
"tenantResultLookup": "not supplied"
}
}
```
Read the important path as browser -> F1 API -> F2 queue -> F3 worker -> F4 origin. The separate result read follows F6 to the artifact store written at F5. The external origin can return redirects/content, but this case does not assume it controls the private queue, an administrator or worker credentials.
## Worked threat analysis and release gate
Scope: preview-design-3. Trust changes at F1 (untrusted editor URL enters authenticated API), F2/F3 (request becomes a worker instruction), F4 (worker network authority acts on that URL) and F6 (caller chooses a stored result). A private queue protects message transport from outsiders; it does not make the editor-supplied URL trusted. HTML escaping protects an output context, not the outbound fetch destination.
T1 — destination authority, prioritized before launch: the supplied design confirms redirect-following, but supplies no destination/egress enforcement or worker identity. An authenticated editor controls the initial URL and an external origin can control a redirect. Internal-service access or credential exposure is a threat hypothesis, not a confirmed exploit: network reach, parser/resolver behavior and credentials are unknown. Owner: platform engineer. Prefer removing arbitrary URL fetches if unnecessary; otherwise isolate the fetcher, restrict outbound destinations at the appropriate layer, and validate every permitted destination/redirect under the actual resolver contract. In an authorized isolated staging setup, prove approved public-origin success and prohibited destination/redirect rejection with owned targets only. Do not probe metadata or internal endpoints during this review.
T2 — tenant result disclosure, unresolved: F6 accepts a job ID, but its tenant authorization path is missing. Do not assert an IDOR exists, and do not call an unguessable ID a mitigation. Owner: API engineer. Require the real lookup/policy trace and owned same-tenant, other-tenant and missing-job tests; result storage being keyed by tenant does not prove the caller lookup enforces it. A failure must return the agreed non-disclosing response without fetching another tenant's artifact.
T3 — resource exhaustion, unresolved: a two-second fetch limit is a stated design control, not a measured result, and says nothing alone about bytes, decoded image memory, concurrency or per-tenant work. Owner: preview service engineer. Define fetch/decode byte and dimension limits, cancellation, queue/concurrency quotas and rejection behavior. Use small owned boundary fixtures; do not load-test production. Even a correct byte cap does not prove tenant authorization or destination isolation.
Release decision: HOLD for these missing control/verification records, not because this document proves a production breach. The asset inventory is editor results, stored input/output and worker availability/authority; private retention and log content remain open questions. Review the diagram with the API/platform owners, attach versioned evidence for each test and record residual risk/acceptance owner. No request was sent, no cloud permission was inspected and no scanner or exploit was executed.
## Verify the model itself before testing a system
Check that every referenced node/flow exists, each control has an evidence status, and mitigations address the identified authority rather than a different layer. An optional local inventory check is included below; it validates this document's shape only. It cannot discover a vulnerability or declare a control effective. Save as threat-inventory.mjs and run node threat-inventory.mjs; no dependencies, network or external files are used.
```js
import assert from "node:assert/strict";
const previewThreatFacts = {
"revision": "preview-design-3 (fictional, not OneLiners)",
"purpose": "A tenant editor asks for a thumbnail of a public URL, then retrieves that editor's tenant-scoped result.",
"nodes": [
"browser",
"api",
"queue",
"worker",
"origin",
"artifact-store",
"result-api"
],
"flows": [
{
"id": "F1",
"from": "browser",
"to": "api",
"data": "URL supplied by editor; API verifies session and derives tenant from it"
},
{
"id": "F2",
"from": "api",
"to": "queue",
"data": "job ID, server-derived tenant and unchanged URL"
},
{
"id": "F3",
"from": "queue",
"to": "worker",
"data": "private queue message; worker follows URL redirects"
},
{
"id": "F4",
"from": "worker",
"to": "origin",
"data": "outbound fetch; destination DNS/address/egress enforcement not supplied"
},
{
"id": "F5",
"from": "worker",
"to": "artifact-store",
"data": "thumbnail stored under server job/tenant key; raw content retention unknown"
},
{
"id": "F6",
"from": "result-api",
"to": "artifact-store",
"data": "lookup by caller-supplied job ID; tenant authorization code not supplied"
}
],
"controls": {
"apiScheme": "HTTP/HTTPS only",
"redirects": "followed",
"destinationRestriction": "not supplied",
"workerIdentity": "not supplied",
"outputEncoding": "HTML escaping documented",
"fetchTimeLimit": "2 seconds documented, not execution-verified",
"responseByteLimit": "not supplied",
"tenantResultLookup": "not supplied"
}
};
function validateThreatFacts(facts) {
assert.ok(facts && typeof facts.revision === "string" && facts.revision.length > 0, "versioned design required");
assert.ok(Array.isArray(facts.nodes) && new Set(facts.nodes).size === facts.nodes.length, "unique nodes required");
assert.ok(Array.isArray(facts.flows) && new Set(facts.flows.map((flow) => flow.id)).size === facts.flows.length, "unique flow IDs required");
for (const flow of facts.flows) assert.ok(facts.nodes.includes(flow.from) && facts.nodes.includes(flow.to) && flow.data, "each flow needs known endpoints and its data");
for (const key of Object.keys(previewThreatFacts.controls)) assert.ok(typeof facts.controls?.[key] === "string" && facts.controls[key].length > 0, "explicit known/unknown control required: " + key);
return { revision: facts.revision, flowIds: facts.flows.map((flow) => flow.id), scope: "Design inventory validated, not an exploit or security control test." };
}
console.log(validateThreatFacts(previewThreatFacts));
```
## Use references and stop at missing evidence
[OWASP threat modeling](https://cheatsheetseries.owasp.org/cheatsheets/Threat_Modeling_Cheat_Sheet.html) informs the flow/boundary review; [OWASP SSRF prevention](https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html) informs the outbound-fetch proof obligations. These sources do not establish this fictional system's network reach or a real application's security. Return prioritized cases with actor, prerequisite, flow IDs, affected asset, evidence status, response/owner, bounded verification and residual risk. Revisit the model when redirects, permissions, tenancy, retention or deployment changes. Never convert a hypothesis into an unapproved request, credential test or permission change.
Real example
Input
Use the complete fictional preview-design-3 facts and F1–F6 flows in SKILL.md. Prioritize destination authority, tenant result lookup and resource exhaustion. Distinguish documented behavior, threat hypothesis and missing control evidence; do not send any request or scan a system.
Expected result
Scope: preview-design-3. Trust changes at F1 (untrusted editor URL enters authenticated API), F2/F3 (request becomes a worker instruction), F4 (worker network authority acts on that URL) and F6 (caller chooses a stored result). A private queue protects message transport from outsiders; it does not make the editor-supplied URL trusted. HTML escaping protects an output context, not the outbound fetch destination. T1 — destination authority, prioritized before launch: the supplied design confirms redirect-following, but supplies no destination/egress enforcement or worker identity. An authenticated editor controls the initial URL and an external origin can control a redirect. Internal-service access or credential exposure is a threat hypothesis, not a confirmed exploit: network reach, parser/resolver behavior and credentials are unknown. Owner: platform engineer. Prefer removing arbitrary URL fetches if unnecessary; otherwise isolate the fetcher, restrict outbound destinations at the appropriate layer, and validate every permitted destination/redirect under the actual resolver contract. In an authorized isolated staging setup, prove approved public-origin success and prohibited destination/redirect rejection with owned targets only. Do not probe metadata or internal endpoints during this review. T2 — tenant result disclosure, unresolved: F6 accepts a job ID, but its tenant authorization path is missing. Do not assert an IDOR exists, and do not call an unguessable ID a mitigation. Owner: API engineer. Require the real lookup/policy trace and owned same-tenant, other-tenant and missing-job tests; result storage being keyed by tenant does not prove the caller lookup enforces it. A failure must return the agreed non-disclosing response without fetching another tenant's artifact. T3 — resource exhaustion, unresolved: a two-second fetch limit is a stated design control, not a measured result, and says nothing alone about bytes, decoded image memory, concurrency or per-tenant work. Owner: preview service engineer. Define fetch/decode byte and dimension limits, cancellation, queue/concurrency quotas and rejection behavior. Use small owned boundary fixtures; do not load-test production. Even a correct byte cap does not prove tenant authorization or destination isolation. Release decision: HOLD for these missing control/verification records, not because this document proves a production breach. The asset inventory is editor results, stored input/output and worker availability/authority; private retention and log content remain open questions. Review the diagram with the API/platform owners, attach versioned evidence for each test and record residual risk/acceptance owner. No request was sent, no cloud permission was inspected and no scanner or exploit was executed.