Skip to Content
Mengty Learns
Security

Threat Modeling with STRIDE

How to run a lightweight STRIDE threat model before writing code, with a data-flow diagram and worked example for this static site, localStorage, and its RSS inbox workflow.

how-tobeginnerTested with asvs 5.0.0 (V15), owasp_top_10 2025 (A06)Updated Nov 26, 2026

TL;DR

STRIDE (Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of Privilege) is a 30-minute design check before writing code. Draw a data-flow diagram (DFD), mark trust boundaries, and ask what can go wrong at each crossing.

Why it exists

Most severe flaws (A06:2025 Insecure Design) cannot be fixed by a linter—they are missing controls at design time. A lightweight threat model before building a feature catches trust-boundary bugs while they are still cheap to change on a whiteboard.

1. What are we building? (Worked DFD: Mengty Learns)

Mengty Learns has two distinct data flows:

  1. Reader flow: Visitor browser loads static HTML/JS from CDN/Pages and stores flashcard/quiz progress in localStorage (mt-*-v1).
  2. Inbox flow (.github/workflows/inbox.yml): A scheduled GitHub Action fetches external RSS feeds via scripts/inbox.mjs and writes a private GitHub Issue (permissions: issues: write).
Trust boundaries sit between Browser and localStorage, and between external RSS feeds and the GitHub Actions runner.

2. What can go wrong? (STRIDE on this site)

ThreatExample on this siteMitigation
SpoofingSpoofed CDN origin or fake GitHub Action dependency.HTTPS + HSTS at edge; pin GitHub Actions to full 40-char SHAs (supply-chain).
TamperingUser edits localStorage (mt-*-v1); malicious RSS <title> injects markdown/links into the inbox issue.localStorage holds only personal study state (no auth/trust); sanitize/truncate RSS fields and never auto-publish inbox.yml output.
RepudiationUnclear who changed security-critical content or workflows.Signed/reviewed PRs on main and Git commit history.
Information DisclosureAccidental NEXT_PUBLIC_* secret or private inbox/*.json published in out/.Keep inbox.yml writing to GitHub Issues (not public/); never put secrets in client bundles.
Denial of ServiceOversized RSS feed hangs inbox.mjs in CI; huge SVG/diagram stalls browser.Fetch timeouts + size bounds in inbox.mjs; build-time diagram node/step caps (DIAGRAM-RULES).
Elevation of PrivilegeCompromised inbox.yml token pushes code to main.inbox.yml sets permissions: issues: write only—it cannot write repository contents.

Do it: 4-step threat model in 30 minutes

  1. Draw the DFD: Boxes for processes/stores/externals, arrows for data flows, dashed lines for trust boundaries.
  2. Walk each boundary with STRIDE: Spend 5 minutes per crossing—skip categories that don't apply.
  3. Decide mitigations: Mitigate, accept (document why), transfer, or eliminate (for example, keeping this site static eliminates server auth threats entirely).
  4. Verify in PRs: Turn the top 2–3 mitigations into automated tests, CI permission checks, or checklist items.

Gotchas

  • Threat modeling after launch: Waiting until a pen test turns architectural flaws into expensive rewrites.
  • Listing generic threats ("someone hacks the DB"): Always tie each STRIDE item to a specific DFD edge and trust boundary.
  • Forgetting localStorage is attacker-controlled: Never trust localStorage values for authorization or render raw strings from localStorage into innerHTML.

Production checklist

  • Every new feature with a new trust boundary (auth, upload, webhook, external fetch) gets a 30-minute STRIDE review.
  • All external inputs (RSS feeds, user URLs, localStorage JSON) are validated/sanitized at the boundary.
  • CI workflows declare minimal permissions: so a compromised job cannot escalate privileges.
  • Accepted risks are recorded in an ADR or design doc with owner and date.

Check yourself

Check Yourself

1. In STRIDE, which threat category is mitigated by setting permissions: issues: write (and not contents: write) on .github/workflows/inbox.yml?

2. Why is 'Tampering with localStorage' low-impact for Mengty Learns' flashcard progress, yet critical if an app stores role='admin' in localStorage?

Sources