Threat Model
Threat model a feature or system with STRIDE: trust boundaries, ranked threats with attack paths, and mitigations mapped to real controls.
Threat model this system. What it does and who uses it: [SYSTEM + USER TYPES INCLUDING ANONYMOUS ONES] Architecture, data flows, and dependencies: """ [PASTE THE DESIGN, THE RELEVANT CODE, OR A DESCRIPTION OF COMPONENTS AND HOW DATA MOVES BETWEEN THEM] """ Data handled: [WHAT KINDS, INCLUDING PERSONAL, PAYMENT, HEALTH, OR CREDENTIALS] Authentication and authorization today: [HOW IT WORKS] Existing controls: [WAF, RATE LIMITS, ENCRYPTION, LOGGING, REVIEWS] What would be worst for this business: [THE OUTCOME YOU MOST WANT TO AVOID] Produce: 1. **Assets and trust boundaries.** What is worth attacking, and every point where data or control crosses from less trusted to more trusted. List the boundaries explicitly; almost every real vulnerability lives on one. 2. **Threats by STRIDE**, per component and boundary: spoofing, tampering, repudiation, information disclosure, denial of service, elevation of privilege. For each threat, give: - The attack path in concrete steps, starting from what the attacker already has - Who could do it: anonymous internet, authenticated user, another tenant, insider, compromised dependency - What it gets them - Likelihood and impact, with the reasoning rather than just a rating - The mitigation, and whether it exists today, is partial, or is missing 3. **Ranked findings.** The top 5-8 by risk, ordered, each with the smallest change that meaningfully reduces it. Prefer controls that remove the class of bug over controls that catch instances of it. 4. **Multi-tenancy and authorization**, called out separately: for each object a user can reach, what enforces that they can only reach their own. Broken object-level authorization is the most common serious flaw in systems like this and is invisible in an architecture diagram. 5. **Detection.** For each top threat, what would appear in logs or metrics if it happened, and whether we would actually notice. An undetectable threat is worse than it looks on a risk rating. 6. **Assumptions and out of scope**, stated plainly, including what parts of the system this model did not examine. Rules: base findings on the architecture I described. Where you need to know something to judge a threat, ask rather than assuming a control exists. Do not write generic advice; every finding must name a component and an attack path in this system.
How to use
Threat modeling gets skipped because it feels abstract, and the fix is the attack-path requirement: a threat written as concrete steps from what an attacker already has is either obviously real or obviously not. Section 4 deserves its own place because object-level authorization bugs are simultaneously the most common serious finding in web systems and the easiest to miss from a diagram. Section 5 is what turns the model into work for the observability backlog rather than a document.
More coding prompts
Write the commit message for this change. Diff: """ [PASTE THE STAGED DIFF] """ Why I made this change: [THE REASON, THE TICKET, THE BUG REPORT, or "you infer it"] Convention: [Conventional Commits / this repo's existing style, pasted below / plain] Recent commits from this repo, to match style: """ [PASTE 5-10 RECENT COMMIT SUBJECT LIN
Commit Message
Write a commit message that explains why the change was made, in Conventional Commits format, split into separate commits when needed.
Help me recover from a git mistake without making it worse. What I was trying to do: [THE GOAL] What I ran: [THE EXACT COMMANDS, IN ORDER] What happened instead: [THE OUTPUT OR THE STATE NOW] Has this been pushed or shared: [YES/NO, and to which branch and whether anyone else has pulled] Uncommitted work I cannot lose: [WHAT AND WHERE, o
Undo a Git Mistake
Recover from a bad commit, force push, wrong branch, or lost work with a reversible plan and the exact commands, explained before you run them.
Handler code, routes, and models: """ [PASTE THE ROUTE DEFINITIONS, HANDLERS, REQUEST AND RESPONSE TYPES, VALIDATION SCHEMAS, AND MIDDLEWARE] """ Generate an OpenAPI 3.1 specification from the code above. API name, version, and base URL: [DETAILS] Auth scheme: [BEARER JWT / API KEY / OAUTH / SESSION COOKIE, and where it is enforced] Con
OpenAPI Spec From Code
Generate an accurate OpenAPI 3.1 spec from handler code, including error responses and auth, with gaps flagged instead of invented.