AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

threat-model-analyst

Full STRIDE-A threat model analysis and incremental update skill for repositories and systems. Supports two modes: (1) Single analysis — full STRIDE-A threat model of a repository, producing architecture overviews, DFD diagrams, STRIDE-A analysis, prioritized findings, and executive assessments. (2) Incremental analysis — takes a previous threat model report as baseline, compares the codebase at the latest (or a given commit), and produces an updated report with change tracking (new, resolved, still-present threats), STRIDE heatmap, findings diff, and an embedded HTML comparison. Only activate when the user explicitly requests a threat model analysis, incremental update, or invokes /threat-model-analyst directly.

Original source
github
License
MIT
Pinned revision
5269f7ea2d6c3a9bfda5ed878b6726cf509121fd

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

Ask your assistant

Use Agentic Memory skills to read github--threat-model-analyst at revision 5269f7ea2d6c3a9bfda5ed878b6726cf509121fd, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 17

references/verification-checklist.md · 24000

init blocks for secondaryColor, tertiaryColor, or primaryTextColor. ❌ "primaryColor": "#2D3748", "secondaryColor": "#4299E1" → ✅ Only 'background': '#ffffff', 'primaryColor': '#ffffff', 'lineColor': '#666666' in themeVariables

  • [ ] Missing summary MMD — Count nodes and subgraphs in 1.1-threatmodel.mmd. If elements > 15 OR subgraphs > 4, 1.2-threatmodel-summary.mmd MUST exist. ❌ Threshold met but file missing → ✅ File created with summary diagram
  • [ ] Standalone sidecar nodes (K8s only) — Search diagrams for nodes named MISE, Dapr, Envoy, Istio, Sidecar as separate entries. ❌ MISE(("MISE Sidecar")) → ✅ InferencingFlow(("Inferencing Flow<br/>+ MISE"))
  • [ ] Intra-pod localhost flows (K8s only) — Search for -->|"localhost"| arrows between co-located containers. ❌ Present → ✅ Absent (implicit)
  • [ ] Missing sequence diagrams — First 3 scenarios in 0.1-architecture.md must each have a sequenceDiagram block. ❌ Fewer than 3 → ✅ At least 3
  • [ ] Technology-specific gaps — For every technology in the repo (Redis, PostgreSQL, Docker, K8s, ML/LLM, NFS, etc.), verify at least one finding or documented mitigation exists. ❌ Technology present but no coverage → ✅ Each technology addressed

0.7 Canonical Pattern Checks

  • [ ] Finding heading pattern — All finding headings match ^### FIND-\d{2}: (never F01, F-01, Finding 1)
  • [ ] CVSS prefix pattern — All CVSS fields match \d+\.\d+ \(CVSS:4\.0/AV: (never bare AV:N/AC:L/...)
  • [ ] Related Threats link pattern — Every Related Threat token matches \[T\d{2}\.[STRIDEA]\]\(2-stride-analysis\.md#[a-z0-9-]+\)
  • [ ] Assessment section headings exact set — Exactly these ## headings in 0-assessment.md: Report Files, Executive Summary, Action Summary, Analysis Context & Assumptions, References Consulted, Report Metadata, Classification Reference
  • [ ] Forbidden headings absent — No ## or ### headings containing: Severity Distribution, Architecture Risk Areas, Methodology Notes, Deliverables, Priority Remediation Roadmap, Key Recommendations, Top Recommendations

Phase 1 — Per-File Structural Checks

These checks validate each file independently. They can run in parallel.

1.1 All .md Files

  • [ ] No code-fence wrapping: No .md file starts with ```markdown or ````markdown. Every .md file must begin with a # Heading as its very first line. If any file is wrapped in fences, strip the first and last lines immediately.
  • [ ] No .mmd code-fence wrapping: The .mmd file must NOT start with ```plaintext or ```mermaid. It must start with %%{init: as the very first characters. If wrapped, strip the fence lines.
  • [ ] No empty files: Every file has substantive content beyond the heading.

1.2 0.1-architecture.md

  • [ ] Required sections present: System Purpose, Key Components, Component Diagram, Top Scenarios, Technology Stack, Deployment Model, Repository Structure
  • [ ] Component Diagram exists as a Mermaid flowchart inside a ```mermaid code fence
  • [ ] Architecture styles used — NOT DFD circles (("Name")). Must use ["Name"] or (["Name"]) with service/external/datastore classDef names
  • [ ] At least 3 scenarios have Mermaid sequenceDiagram blocks
  • [ ] No separate .mmd files were created for 0.1-architecture.md — all diagrams are inline
  • [ ] Component Diagram elements match Key Components table — every row in the table has a corresponding node in the diagram, and vice versa. Count both and verify counts are equal.
  • [ ] Top Scenarios reflect actual code paths, not hypothetical use cases
  • [ ] Deployment Model has network details — must mention at least: port numbers OR bind addresses OR network topology

1.3 1.1-threatmodel.mmd

  • [ ] File exists with pure Mermaid code (no markdown wrapper, no ```mermaid fence)
  • [ ] Starts with %%{init: block
  • [ ] Contains classDef process, classDef external, classDef datastore
  • [ ] Uses DFD shapes: circles (("Name")) for processes, rectangles ["Name"] for externals, cylinders [("Name")] for data stores

1.4 1-threatmodel.md

  • [ ] Diagram content identical to 1.1-threatmodel.mmd — byte-for-byte comparison of the Mermaid block content (excluding the ```mermaid fence wrapper)
  • [ ] Element Table present with columns: Element, Type, TMT Category, Description, Trust Boundary
  • [ ] Data Flow Table present with columns: ID, Source, Target, Protocol, Description
  • [ ] Trust Boundary Table present with columns: Boundary, Description, Contains
  • [ ] TMT Category IDs used — Element Table's TMT Category column uses specific TMT element IDs from tmt-element-taxonomy.md (e.g., SE.P.TMCore.WebSvc, SE.EI.TMCore.Browser). NOT generic labels like Process, External.
  • [ ] Flow IDs match DF\d{2} pattern — Every flow ID in the Data Flow Table uses DF01, DF02, etc. format. NOT F1, Flow-1, DataFlow1.
  • [ ] If >15 elements or >4 boundaries: 1.2-threatmodel-summary.mmd MUST exist AND 1-threatmodel.md MUST include a "Summary View" section with the summary diagram AND a "Summary to Detailed Mapping" table. To verify: count nodes (lines matching [A-Z]\d+ with shape syntax) and subgraphs in 1.1-threatmodel.mmd. If count exceeds thresholds but 1.2-threatmodel-summary.mmd does not exist → FAIL — create the summary diagram before proceeding.

1.5 2-stride-analysis.md

  • [ ] Exploitability Tiers section present at top with tier definition table
  • [ ] Summary table appears BEFORE individual component sections (immediately after Exploitability Tiers, NOT at the bottom of the file)
  • [ ] Summary table includes columns: Component, Link, S, T, R, I, D, E, A, Total, T1, T2, T3, Risk
  • [ ] Every component has ## Component Name heading followed by Tier 1, Tier 2, Tier 3 sub-sections (all three present even if empty)
  • [ ] Empty tiers use "No Tier N threats identified for this component."
  • [ ] Anchor-safe headings: No ## heading in this file contains ANY of these characters: &, /, (, ), ., :, ', ", +, @, !. Replace: & → and, / → -, parentheses → omit, : → omit.
  • [ ] Pod Co-location line present for K8s components listing co-located sidecars
  • [ ] STRIDE Status values — Every threat row's Status column uses exactly one of: Open, Mitigated, Platform. No Partial, N/A, or other ad-hoc values.
  • [ ] A category labeled Abuse — Search 2-stride-analysis.md for | Authorization | as a STRIDE category label. FAIL if found. The "A" in STRIDE-A is always "Abuse" (business logic abuse, workflow manipulation, feature misuse), NEVER "Authorization". Also check N/A entries: Authorization — N/A is WRONG, must be Abuse — N/A.
  • [ ] STRIDE-Coverage Consistency — For every threat ID, the STRIDE Status and Coverage table Status must agree:
    • STRIDE Open → Coverage ✅ Covered (FIND-XX) (finding documents vulnerability needing remediation)
    • STRIDE Mitigated → Coverage ✅ Mitigated (FIND-XX) (finding documents existing control the team built)
    • STRIDE Platform → Coverage 🔄 Mitigated by Platform
    • If STRIDE says Partial but Coverage says Mitigated by Platform → CONFLICT. Fix it.
    • If STRIDE says Open but Coverage says ⚠️ Needs Review → only valid if prerequisites ≠ None

1.6 3-findings.md

  • [ ] Organized by tier using exactly: ## Tier 1 — Direct Exposure (No Prerequisites), ## Tier 2 — Conditional Risk (...), ## Tier 3 — Defense-in-Depth (...)
  • [ ] NOT organized by severity — no ## Critical Findings or ## Important Findings headings
  • [ ] Every finding has ALL mandatory attributes: SDL Bugbar Severity, CVSS 4.0, CWE, OWASP (with :2025 suffix), Exploitation Prerequisites, Exploitability Tier, Remediation Effort, Mitigation Type, Component, Related Threats
  • [ ] Mitigation Type valid values — Every finding's Mitigation Type row is one of exactly: Redesign, Standard Mitigation, Custom Mitigation, Existing Control, Accept Risk, Transfer Risk. ❌ Abbreviated forms (Custom, Accept, Standard) or invented values → FAIL
  • [ ] SDL Severity valid values — Every finding's severity is one of: Critical, Important, Moderate, Low. ❌ High, Medium, Info → FAIL
  • [ ] Remediation Effort valid values — Every finding's effort is one of: Low, Medium, High. ❌ Time estimates, sprint labels → FAIL
  • [ ] CVSS 4.0 has full vector: Every finding's CVSS value includes BOTH the numeric score AND the full vector string (e.g., 9.3 (CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N)). Score-only is NOT acceptable.
  • [ ] CWE format: Every CWE uses CWE-NNN: Name format (not just number)
  • [ ] OWASP format: Every OWASP uses A0N:2025 format (never :2021)
  • [ ] Related Threats use individual links per threat ID: [T01.S](2-stride-analysis.md#component-name) — no grouped links like [T01.S, T01.T](2-stride-analysis.md)
  • [ ] Exploitation Prerequisites present — Every ### FIND- block has a row | Exploitation Prerequisites |
  • [ ] Component field present — Every ### FIND- block has a row | Component |
  • [ ] No Tier 1 with AV:L or PR:H — For every Tier 1 finding, verify its CVSS vector does NOT contain AV:L or PR:H. If found → tier must be downgraded to T2/T3.
  • [ ] Tier-Prerequisite Consistency (MANDATORY) — For EVERY finding and EVERY threat row, the tier MUST follow mechanically from the prerequisite using the canonical mapping:
    • None → T1 (only valid if component's Reachability = External AND Auth = No)
    • Authenticated User, Privileged User, Internal Network, Local Process Access → T2
    • Host/OS Access, Admin Credentials, Physical Access, {Component} Compromise, any A + B → T3
    • ⛔ FORBIDDEN values: Application Access, Host Access → FAIL. Replace with Local Process Access (T2) or Host/OS Access (T3).
    • Deployment context rule (Rule 20): If Deployment Classification is LOCALHOST_DESKTOP or LOCALHOST_SERVICE, None is FORBIDDEN for all components. Fix prerequisite to Local Process Access or Host/OS Access, then derive tier.
    • Exposure table cross-check: For each finding, look up its Component in the Component Exposure Table. The finding's prerequisite MUST be ≥ the component's Min Prerequisite. The finding's tier MUST be ≥ the component's Derived Tier.
    • Mismatch = FAIL. Fix by adjusting prerequisites to match deployment evidence, then derive tier from prerequisite.
    • Common violations: None on a localhost-only component; Application Access (ambiguous); T1 with Internal Network prerequisite; T2 with None prerequisite.
  • [ ] Threat Coverage Verification table present at end of file mapping every threat ID → finding ID with status
  • [ ] Coverage table valid statuses ONLY — Every row in the Coverage table must use exactly one of these three statuses: ✅ Covered (FIND-XX), ✅ Mitigated (FIND-XX), or 🔄 Mitigated by Platform. ❌ ⚠️ Accepted Risk → FAIL (tool cannot accept risks). ❌ ⚠️ Needs Review → FAIL (every threat must be resolved). ❌ — without a status → FAIL (unaccounted threat).
  • [ ] Mitigated vs Platform distinction — For every ✅ Mitigated (FIND-XX) entry: verify the finding documents an existing security control the engineering team built (auth middleware, TLS, input validation, file permissions). For every 🔄 Mitigated by Platform: verify the mitigation is from a genuinely EXTERNAL system (Azure AD, K8s RBAC, TPM). If "Platform" describes THIS repo's code → reclassify as ✅ Mitigated and create a finding.
  • [ ] Platform Mitigation Ratio Audit (MANDATORY) — Count threats marked 🔄 Mitigated by Platform vs total threats. If Platform > 20% → WARNING: Likely overuse of Platform status. For each Platform-mitigated threat, verify ALL three conditions: (1) mitigation is EXTERNAL to this repo's code, (2) managed by a different team, (3) cannot be disabled by modifying this code. Common violations: "auth middleware" (that's THIS code → should be Mitigated), "TLS on localhost" (THIS code → should be Mitigated), "file permissions" (THIS code → should be Mitigated).
  • [ ] Coverage Feedback Loop Verification — After the Coverage table is written, verify: (1) every threat with STRIDE status Open has a corresponding finding in the table. (2) No — dashes without a status. (3) If gaps exist, new findings were created to fill them. The Coverage table is a FEEDBACK LOOP — its purpose is to catch missed findings and force their creation. If gaps remain after the table is written, the loop was not executed.
  • [ ] "Accepted Risk" in Coverage table — Grep 3-findings.md for Accepted Risk. ❌ Any match → FAIL. The tool does NOT have authority to accept risks. Every Open threat MUST have a finding. Every Mitigated threat MUST have a finding documenting the team's control.
  • [ ] "Needs Review" in Coverage table — Grep 3-findings.md for Needs Review. ❌ Any match → FAIL. "Needs Review" has been replaced: threats are either Covered (vulnerability), Mitigated (team built a control), or Platform (external system). There is no deferred category.

1.7 0-assessment.md

  • [ ] Section order: Report Files → Executive Summary → Action Summary → Analysis Context & Assumptions → References Consulted → Report Metadata → Classification Reference (last)
  • [ ] Report Files section is the very first section after the title
  • [ ] Risk Rating heading has NO emojis: ### Risk Rating: Elevated not ### Risk Rating: 🟠 Elevated
  • [ ] Threat count context paragraph present as blockquote at end of Executive Summary
  • [ ] No separate Recommendations section — Action Summary IS the recommendations
  • [ ] Action Summary table present with Tier, Description, Threats, Findings, Priority columns
  • [ ] Action Summary is the ONLY name: No sections titled "Priority Remediation Roadmap", "Top Recommendations", "Key Recommendations", or "Risk Profile"
  • [ ] Quick Wins subsection present (or explicitly omitted if no low-effort T1 findings)
  • [ ] Needs Verification section present under Analysis Context & Assumptions
  • [ ] References Consulted has two subsections: ### Security Standards and ### Component Documentation
  • [ ] References Consulted tables use three columns with full URLs: | Standard | URL | How Used | and | Component | Documentation URL | Relevant Section | — NOT a flat | Reference | Usage | table
  • [ ] Finding Overrides uses table format even when empty (never plain text)
  • [ ] Report Metadata is the absolute last section before Classification Reference with all required fields
  • [ ] Metadata timestamps came from actual command execution (not derived from folder names)
  • [ ] Model field present — value matches the model being used (e.g., Claude Opus 4.6, GPT-5.3 Codex, Gemini 3 Pro)
  • [ ] Analysis Started and Analysis Completed fields present with UTC timestamps from Get-Date commands
  • [ ] Duration field present — computed from Analysis Started and Analysis Completed timestamps
  • [ ] Metadata values in backticks — Every value cell in the Report Metadata table must be wrapped in backticks. Spot-check at least 5 rows.
  • [ ] Horizontal rules between sections — Count lines matching --- in the file. Must be ≥ 6 (one between each pair of the 7 ## sections).
  • [ ] Classification Reference is last section — ## Classification Reference present as the final ## heading. Contains a single 2-column table (Classification | Values) with rows for: Exploitability Tiers, STRIDE + Abuse, SDL Severity, Remediation Effort, Mitigation Type, Threat Status, CVSS, CWE, OWASP. ❌ Missing section or wrong format → FAIL.
  • [ ] Classification Reference is static — Values in the table must match the skeleton EXACTLY (copied verbatim). No additional rows, no modified descriptions. Compare against skeleton-assessment.md Classification Reference section.
  • [ ] No forbidden section headings — Search for: Severity Distribution, Architecture Risk Areas, Methodology Notes, Deliverables, Priority Remediation Roadmap, Key Recommendations, Top Recommendations. Must return 0 matches.
  • [ ] Action Summary tier priorities are FIXED — In the Action Summary table of 0-assessment.md, verify the Priority column: Tier 1 = 🔴 Critical Risk, Tier 2 = 🟠 Elevated Risk, Tier 3 = 🟡 Moderate Risk. ❌ Tier 1 with Low/Moderate/Elevated → FAIL. ❌ Tier 2 with Critical/Low → FAIL. These are FIXED labels that never change regardless of threat/finding counts.
  • [ ] Action Summary has all 3 tiers — The Action Summary table MUST have rows for Tier 1, Tier 2, AND Tier 3, even if a tier has 0 threats and 0 findings. Missing tiers → FAIL.

Phase 2 — Diagram Rendering Checks

Run against ALL Mermaid blocks across all files. Can be delegated as a focused sub-task.

2.1 Init Blocks

  • [ ] Every flowchart has %%{init}%% block with 'background': '#ffffff' as the first line
  • [ ] Every sequence diagram has the full %%{init}%% theme variables block with 'background': '#ffffff'
  • [ ] NO custom color keys in themeVariables — init block must NOT contain primaryColor (except #ffffff), secondaryColor, or tertiaryColor. All element colors come from classDef only.

2.2 Class Definitions & Color Palette

  • [ ] Every classDef includes color:#000000 (explicit black text)
  • [ ] DFD diagrams use process/external/datastore class names
  • [ ] Architecture diagrams use service/external/datastore class names
  • [ ] EXACT hex codes used — grep all #[0-9a-fA-F]{6} values in .mmd files. The ONLY allowed fill colors are: #6baed6, #fdae61, #74c476, #ffffff, #000000. The ONLY allowed stroke colors are: #2171b5, #d94701, #238b45, #e31a1c, #666666. If ANY other hex color appears (e.g., #4299E1, #48BB78, #E53E3E, #2B6CB0), the diagram FAILS this check.

2.3 Styling

  • [ ] Every flowchart has linkStyle default stroke:#666666,stroke-width:2px
  • [ ] Trust boundary styles use stroke:#e31a1c,stroke-width:3px (NOT #ff0000 or stroke-width:2px)
  • [ ] Architecture layer styles use light fills with matching borders (not red dashed trust boundaries)

2.4 Syntax Validation

  • [ ] All labels quoted: ["Name"], (("Name")), [("Name")], -->|"Label"|, subgraph ID["Title"]
  • [ ] Subgraph/end pairs matched: Every subgraph has a closing end
  • [ ] No stray characters or unclosed quotes in any Mermaid block

2.5 Kubernetes Sidecar Rules

Skip this section if the target system is NOT deployed on Kubernetes.

  • [ ] Every K8s service node annotated with sidecars: <br/>+ SidecarName in the node label
  • [ ] Zero standalone sidecar nodes: Search all diagrams for nodes named MISE, Dapr, Envoy, Istio, Sidecar — these must NOT exist as separate nodes
  • [ ] Zero intra-pod localhost flows: No arrows between a container and its sidecars (no -->|"localhost" patterns)
  • [ ] Cross-boundary sidecar flows originate from host container: All arrows to external targets (Azure AD, Redis, etc.) come from the host container node, not from a standalone sidecar node
  • [ ] Element Table: No separate rows for sidecars — described in host container's description column

Phase 3 — Cross-File Consistency Checks

These checks validate relationships between files. They require reading multiple files together.

3.1 Component Coverage (Architecture → STRIDE → Findings)

  • [ ] Every component in 0.1-architecture.md Key Components table has a corresponding ## Component section in 2-stride-analysis.md
  • [ ] Every element in the 1-threatmodel.md Element Table that is a Process has a corresponding ## Component section in 2-stride-analysis.md
  • [ ] No orphaned components in 2-stride-analysis.md that don't appear in the Element Table
  • [ ] Summary table component count matches the number of ## Component sections in the file
  • [ ] Component count exact match — Count rows in 0.1-architecture.md Key Components table (excluding header/separator). Count ## component sections in 2-stride-analysis.md (excluding ## Exploitability Tiers, ## Summary). These counts MUST be equal.

3.2 Data Flow Coverage (STRIDE ↔ DFD)

  • [ ] Every Data Flow ID (DF01, DF02, ...) from the 1-threatmodel.md Data Flow Table appears in at least one "Affected Flow" cell in 2-stride-analysis.md
  • [ ] No orphaned flow IDs in STRIDE analysis that aren't defined in the Data Flow Table

3.3 Threat-to-Finding Traceability (STRIDE ↔ Findings)

This is the most critical cross-file check. It ensures no identified threat is silently dropped.

  • [ ] Every threat ID in 2-stride-analysis.md (e.g., T01.S, T01.T1, T02.I) is referenced by at least one finding in 3-findings.md via its Related Threats field
  • [ ] Collect all threat IDs from all tier tables in 2-stride-analysis.md
  • [ ] Collect all threat IDs referenced in Related Threats fields in 3-findings.md
  • [ ] Coverage gap report: List any threat ID present in STRIDE but missing from findings. If gaps exist → either add a finding or group the threat into an existing related finding

3.4 Finding-to-STRIDE Anchor Integrity (Findings → STRIDE)

  • [ ] Every Related Threats link in 3-findings.md uses format [ThreatID](2-stride-analysis.md#component-anchor)
  • [ ] Every #component-anchor resolves to an actual ## Heading in 2-stride-analysis.md
  • [ ] Anchor construction verified: heading → lowercase → spaces to hyphens → strip non-alphanumeric except hyphens
  • [ ] Spot-check at least 3 anchors by following the link and confirming the threat ID exists under that heading

3.5 Count Consistency (Assessment ↔ All Files)

  • [ ] Element count in Executive Summary matches actual Element Table row count in 1-threatmodel.md
  • [ ] Finding count in Executive Summary matches actual finding count in 3-findings.md
  • [ ] Threat count in Executive Summary matches Total from summary table in 2-stride-analysis.md
  • [ ] Tier counts in threat count context paragraph match actual T1/T2/T3 totals from 2-stride-analysis.md
  • [ ] Action Summary tier table counts match actual per-tier counts from 3-findings.md (findings column) and 2-stride-analysis.md (threats column)

Verification methods for count checks:

  • Element count: count | rows in Element Table of 1-threatmodel.md, subtract 2 (header + separator)
  • Finding count: count ### FIND- headings in 3-findings.md
  • Threat count: read the Totals row in 2-stride-analysis.md Summary table, take the Total column value
  • Tier counts: from same Totals row, take T1, T2, T3 column values

3.6 STRIDE Summary Table Arithmetic

  • [ ] Per-row: S + T + R + I + D + E + A = Total for every component
  • [ ] Per-row: T1 + T2 + T3 = Total for every component
  • [ ] Totals row: Each column sum across all component rows equals the Totals row value
  • [ ] Row count cross-check: Number of threat rows in each component's detail tables equals its Total in the summary table
  • [ ] No artificial all-1s pattern: Check the Summary table for the pattern where every STRIDE column (S,T,R,I,D,E,A) is exactly 1 for every component. If ALL components have exactly 1 threat in every STRIDE category → FAIL (indicates formulaic "minimum 1 per category" inflation rather than genuine analysis). A valid analysis should have varying counts per category reflecting actual attack surface: some categories may be 0 (with N/A justification), others 2-3. Uniform 1s across all components is a stro