/build-like-amazon:threat-modelingfrom build-like-amazon
Systematic security threat modeling using STRIDE methodology adapted for cloud services. Covers data classification, IAM boundaries, encryption requirements, blast radius analysis, and attack vector identification during design phase.
Ships in build-like-amazon. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Threat modeling is the systematic identification of security threats to a system BEFORE the system is built. It answers four questions: What are we building? What can go wrong? What are we going to do about it? Did we do a good enough job? You cannot secure a system by adding security after the fact—security must be designed in. Threat modeling is how you design it in.
A threat model is not a penetration test. Penetration testing finds bugs in implementation. Threat modeling finds flaws in design. A perfectly implemented system with a flawed design is still insecure. You do threat modeling at design time; you do pen testing at implementation time. Both are required; neither replaces the other.
Load agents/security-guardian.md when reviewing the threat model. Use it to challenge trust boundaries, data classification, least privilege, encryption, blast radius, and missing abuse cases.
Write the threat model into .bla/design/<feature-name>/threat-model.md — <service-name> when /onboard Path A produces the baseline off existing code — following skills/threat-modeling/templates/threat-model-template.md; that file is the shape of the threat model, never its destination. The template records the decisions this skill produces — classification, boundaries, STRIDE per crossing, IAM, encryption, blast radius, accepted risks — and deliberately does not restate the tables below, which are the authority. It uses this skill's own Critical/High/Medium/Low severities, mapped to the canonical levels in AGENTS.md → One Severity Scale and One Verdict Scale, and adds no new label.
Threat models are living documents maintained alongside design documents. They are updated when the system changes, when new threat intelligence emerges, or when incidents reveal gaps. Every system that handles customer data, credentials, or payment information requires a formal threat model reviewed by security teams before launch.
The principle of "blast radius minimization" is paramount: design systems so that a compromise of one component cannot cascade to compromise the entire system. This drives decisions about service boundaries, IAM scope, encryption key separation, and network isolation.
Before identifying threats, classify the data your system handles:
| Classification | Definition | Examples | Requirements |
|---|---|---|---|
| Restricted | Compromise causes severe harm to customers or business. Regulatory implications. | Payment card numbers, SSNs, authentication credentials, encryption keys | Encrypted at rest AND in transit. Access logged. Minimal retention. Need-to-know access. Annual audit. |
| Confidential | Internal business data. Competitive advantage if disclosed. | Customer PII (name, email, address), internal financial data, unreleased product plans | Encrypted at rest AND in transit. Access controlled by role. Retention policy enforced. |
| Internal | Not public but low sensitivity. Operational data. | Service metrics, internal documentation, team rosters, non-sensitive logs | Encrypted in transit. Access controlled by team. Standard retention. |
| Public | Intended for public consumption. | Marketing content, public documentation, open-source code | Integrity protection (prevent tampering). No confidentiality requirements. |
Rule: A system's classification is determined by the HIGHEST classification of data it handles. A service that processes one Restricted field is a Restricted service.
Create a Data Flow Diagram (DFD) that identifies:
Draw lines around components that share the same trust level:
┌─────────────────────── Internet (Untrusted) ───────────────────────┐
│ [Browser] [Mobile App] [Partner API] │
└──────────────────────────┬─────────────────────────────────────────┘
│ TLS
┌──────────────────────────┼─── Public Subnet ───────────────────────┐
│ [API Gateway + WAF] │
└──────────────────────────┬─────────────────────────────────────────┘
│ IAM Auth
┌──────────────────────────┼─── Private Subnet ──────────────────────┐
│ [Application Service] │
│ │ │
│ ┌────────────┼────────────┐ │
│ ▼ ▼ ▼ │
│ [DynamoDB] [S3 Bucket] [SQS Queue] │
└────────────────────────────────────────────────────────────────────┘
│ Cross-account role
┌──────────────────────────┼─── Separate Account ────────────────────┐
│ [Audit Log Store] │
└────────────────────────────────────────────────────────────────────┘
Every crossing of a trust boundary is a potential attack surface.
For each element and data flow in the DFD, systematically analyze threats using STRIDE:
| Category | Threat | Question to Ask | Example |
|---|---|---|---|
| Spoofing | Identity falsification | Can an attacker pretend to be someone/something else? | Attacker forges JWT to impersonate another user |
| Tampering | Data modification | Can an attacker modify data in transit or at rest? | Man-in-the-middle modifies API request; attacker modifies S3 object |
| Repudiation | Denying actions | Can an actor deny performing an action with no proof? | Admin deletes records with no audit trail |
| Information Disclosure | Data leakage | Can an attacker access data they shouldn't? | Error messages expose internal system details; logs contain PII |
| Denial of Service | Availability disruption | Can an attacker make the system unavailable? | Unbounded request causes OOM; regex DoS; resource exhaustion |
| Elevation of Privilege | Unauthorized access escalation | Can an attacker gain higher privileges? | SSRF to access instance metadata; SQL injection to admin role |
For each component in your DFD, fill in:
Component: [Name]
Trust Level: [What trust boundary is it in?]
Data Classification: [Highest classification of data it touches]
| STRIDE | Applicable? | Threat Scenario | Likelihood | Impact | Mitigation |
|--------|-------------|----------------|-----------|--------|-----------|
| Spoofing | Yes/No | [Specific scenario] | H/M/L | H/M/L | [Control] |
| Tampering | Yes/No | [Specific scenario] | H/M/L | H/M/L | [Control] |
| Repudiation | Yes/No | [Specific scenario] | H/M/L | H/M/L | [Control] |
| Info Disclosure | Yes/No | [Specific scenario] | H/M/L | H/M/L | [Control] |
| DoS | Yes/No | [Specific scenario] | H/M/L | H/M/L | [Control] |
| EoP | Yes/No | [Specific scenario] | H/M/L | H/M/L | [Control] |
| Pattern | Threat | Mitigation |
|---|---|---|
| Shared IAM role across services | Compromise of one service = compromise of all | Separate role per service, minimum permissions |
| Wildcard resource in policy | Any resource accessible, not just intended ones | Explicit ARNs; use conditions for dynamic resources |
| No MFA on privileged operations | Credential theft = full access | Require MFA for all human privileged operations |
| Long-lived access keys | Keys leaked in code/logs = persistent access | Use IAM roles with temporary credentials; rotate keys <90 days |
| Instance metadata accessible | SSRF → credential theft via 169.254.169.254 | IMDSv2 (require token); restrict network access to metadata |
| Over-scoped Lambda execution role | Compromised function has broad access | Least privilege per function; separate roles per Lambda |
| Data State | Classification: Restricted | Classification: Confidential | Classification: Internal |
|---|---|---|---|
| At rest | KMS CMK (team-managed key), key rotation enabled | KMS CMK or AWS-managed key | AWS-managed key or SSE-S3 |
| In transit | TLS 1.2+ (mandatory) | TLS 1.2+ (mandatory) | TLS 1.2+ (recommended) |
| In memory | Clear from memory after use; don't log | Standard precautions | Standard precautions |
| In backups | Same encryption as primary | Same encryption as primary | AWS-managed encryption |
| In logs | MUST NOT appear in logs | Mask/redact; tokenize | Acceptable in logs |
Blast radius = the extent of damage if a single component is fully compromised.
For each component, answer:
| Strategy | Implementation | Reduces Blast Radius By |
|---|---|---|
| Service isolation | Separate IAM roles per service | Prevents lateral movement via credentials |
| Network segmentation | Security groups with explicit allow lists | Prevents network-based lateral movement |
| Account boundaries | Separate AWS accounts for different trust levels | Hard boundary; cross-account requires explicit grant |
| Data compartmentalization | Different encryption keys per data domain | Compromised key exposes only one domain |
| Privilege separation | Read and write through different roles/paths | Compromised read path can't modify data |
| Secret rotation | Automated, frequent rotation of all secrets | Limits window of exposure for leaked secrets |
| Circuit breakers | Rate limits between services | Prevents cascading resource exhaustion |
Rate each component:
| Score | Blast Radius | Criteria |
|---|---|---|
| Critical | System-wide compromise | Component has admin access, cross-service credentials, or access to encryption keys for multiple services |
| High | Multiple services affected | Component can access data or systems beyond its own boundary |
| Medium | Single service affected | Compromise is contained to this service's data and functionality |
| Low | Minimal impact | Component is stateless, has no persistent data access, and is easily replaced |
Any component scoring "Critical" must be re-architected to reduce blast radius.
| Attack | Vector | Mitigation |
|---|---|---|
| SSRF to metadata | Application fetches attacker-controlled URL → 169.254.169.254 | IMDSv2; block metadata IP in application egress |
| Confused deputy | Attacker tricks your service into acting on their behalf | External ID in cross-account roles; validate caller identity |
| S3 bucket enumeration | Predictable bucket names → unauthorized access | Random bucket name suffixes; block public access; bucket policies |
| Lambda event injection | Malicious input in event payload | Validate and sanitize all event fields; treat events as untrusted |
| IAM privilege escalation | iam:PassRole + lambda:CreateFunction = arbitrary code execution as any role | Restrict iam:PassRole to specific role ARNs; permissions boundaries |
| Supply chain attack | Compromised dependency in build pipeline | Pin dependencies; verify checksums; scan for vulnerabilities; use private registry |
| Log injection | Attacker injects malicious content into logs → exploits log viewers | Sanitize log output; structured logging; separate log viewers from production |
| Intention | Mechanism |
|---|---|
| "I'll encrypt sensitive data" | KMS key policies that deny unencrypted writes; S3 bucket policies that require SSE |
| "I'll follow least privilege" | IAM Access Analyzer reviews weekly; over-permissioned roles auto-generate tickets |
| "I'll audit access to sensitive data" | CloudTrail data events mandatory for all Restricted/Confidential data stores |
| "I'll keep secrets safe" | Secrets Manager with automated rotation; credential scanning in CI blocks commits with secrets |
| "I'll limit blast radius" | Separate AWS accounts per trust boundary; network isolation verified by automated tests |
| What They Say | Why It's Wrong | What To Do Instead |
|---|---|---|
| "We'll add security later, we need to ship fast" | Security bolted on after the fact is expensive and incomplete. Architecture decisions made without threat modeling create vulnerabilities that require re-architecture to fix. | Threat model during design. It takes 2-4 hours. Re-architecting for security later takes weeks. |
| "We're not a target; attackers focus on bigger companies" | Automated attacks don't discriminate. Bots scan every public endpoint. Supply chain attacks target small components. You ARE a target the moment you have a public endpoint or store customer data. | Model threats regardless of perceived risk. The model will tell you which threats are low-likelihood. Don't skip the analysis. |
| "Our data isn't that sensitive" | Have you classified it? PII includes name + email. Payment data includes partial card numbers. Internal data includes access patterns that reveal business strategy. | Classify your data formally. You may be surprised what's actually Confidential when you apply the classification framework. |
| "IAM is too complex; we'll use broad permissions and tighten later" | Tightening permissions breaks things. Teams never tighten. Broad permissions persist forever and become the assumed blast radius. | Start with zero permissions. Add one permission at a time. Use IAM Access Analyzer to verify you're not over-provisioned. |
| "Encryption at rest doesn't matter if the network is secure" | Networks are breached. Insiders exist. Backups are stolen. Disks are improperly decommissioned. Encryption at rest is defense in depth, not redundancy. | Encrypt at rest. Always. The cost is negligible. The protection is essential. |
Resource: "*" with no documented justificationWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
threat-modeling, stride, security-design, attack-vectors, iam-boundaries
npx claudepluginhub robisson/build-like-amazon-agent-skills --plugin build-like-amazon28 skills in this plugin
/api-contract-firstDesigning APIs contract-first with backward compatibility guarantees, clear versioning strategy, error semantics, idempotency, and pagination. The API is a promise—never break existing clients./brownfield-discoveryReverse-engineer an existing project to produce a Design Doc, API contracts, and a Threat Model anchored in the real code, IaC, and observability. Run once per project. Output anchors all subsequent /spec and /build invocations./code-review-bar-raisingApplying Amazon's raise-the-bar principle to every code review. What reviewers look for — clarity, correctness, design, reuse, operational readiness. "Ship It" means the change raises or maintains the quality bar./correction-of-errorsBlameless post-incident analysis focused on timeline, 5 Whys, mechanisms over people, and concrete action items with owners./dependency-managementManaging external dependencies safely with circuit breakers, timeouts, retries with exponential backoff, bulkhead pattern, graceful degradation, and dependency isolation./design-documentWriting a technical design document that translates a Working Backwards output into a concrete, reviewable engineering plan with architecture, trade-offs, cost estimation, and operational concerns.Other plugins' skills for the same job