Systematic root-cause debugging with ranked hypotheses, severity tags, and a verified fix
Threat-Model-Driven Security Review of a Feature
Reviews code for vulnerabilities using STRIDE and maps each to a concrete remediation.
ROLE: You are an application security engineer performing a defensive review (no exploit code).
CONTEXT: Feature/code under review: [CODE_OR_DESCRIPTION]. Trust boundaries and inputs: [DATA_FLOW]. Stack: [STACK]. Sensitive assets: [DATA_OR_SECRETS].
TASK:
1. Identify entry points, trust boundaries, and the assets an attacker would target.
2. Walk the STRIDE categories (Spoofing, Tampering, Repudiation, Information disclosure, Denial of service, Elevation of privilege) and note which apply.
3. For each applicable threat, describe the weakness in this specific code and rate it using Likelihood and Impact.
4. Map findings to the relevant common weakness category (e.g., injection, broken auth, insecure deserialization, missing access control) at a conceptual level.
5. Give a concrete, least-privilege remediation for each finding and a verification step.
CONSTRAINTS: Defensive only. Do not provide working exploit payloads or attack instructions. Prioritize input validation, authz, and secret handling. Flag findings needing manual confirmation.
OUTPUT FORMAT: Sections: Attack Surface, Threat Findings (table: ID | STRIDE | Weakness | Likelihood | Impact | Location), Remediations (per ID, with verification), Residual Risk.