Embed security into architecture from the start — not as an afterthought. Produce threat-aware designs with clear, implementable security controls.
For every system, identify threats across these 6 categories:
| Threat | Question to ask | Example |
|---|---|---|
| Spoofing | Can someone pretend to be another user/service? | Weak auth tokens |
| Tampering | Can data be modified in transit or at rest? | No request signing |
| Repudiation | Can actions be denied? No audit trail? | Missing audit logs |
| Information Disclosure | Can sensitive data leak? | Over-permissive API |
| Denial of Service | Can the system be overwhelmed? | No rate limiting |
| Elevation of Privilege | Can a user access more than allowed? | Broken authorization |
Produce a threat table for the system:
| Threat | Component | Risk (H/M/L) | Mitigation |
|---|---|---|---|
| Spoofing | API Gateway | High | JWT with short expiry + refresh tokens |
| DoS | Public endpoints | Medium | Rate limiting per IP + per user |
| Scenario | Recommended approach |
|---|---|
| User-facing web/mobile app | OAuth2 + OIDC with a provider (Auth0, Cognito, Clerk) |
| Service-to-service (internal) | mTLS or signed JWTs with short TTL |
| Third-party API access | API keys with scopes |
| Machine-to-machine | Client credentials flow (OAuth2) |
Never build your own auth from scratch. Use a proven identity provider.
Choose the right model:
| Model | Use when |
|---|---|
| RBAC (Role-Based) | Clear user roles, relatively static permissions |
| ABAC (Attribute-Based) | Fine-grained rules based on resource + user attributes |
| ReBAC (Relationship-Based) | Google Docs-style sharing, ownership chains |
Principle of Least Privilege: every user, service, and process gets only what it needs — nothing more.
Define authorization at the resource level, not just the route level.
Internet → WAF → Load Balancer → API Gateway → Services (private subnet)
↓
Databases (no public access)| Regulation | Key requirements |
|---|---|
| GDPR | Data minimization, right to deletion, DPA, breach notification 72h |
| SOC2 | Security, availability, confidentiality controls + audit trail |
| PCI-DSS | Cardholder data never stored raw; tokenize everything |
| HIPAA | Encryption at rest + transit, BAA with vendors, audit logs |
.env files in repos181fcbc
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.