1---2name: moai-ref-owasp-checklist3description: OWASP Top 10 security checklist, authentication patterns, input validation, and HTTP security headers reference. Agent-extending skill that amplifies expert-security and expert-backend expertise with production-grade security patterns. NOT for: frontend UI, DevOps deployment, performance optimization, testing strategy.4---56# OWASP Security Checklist Reference78## Target Agents910- `expert-security` - Primary: applies checklist during security audits11- `expert-backend` - Secondary: applies during API implementation1213## OWASP API Security Top 101415| Rank | Vulnerability | Check | Defense |16|------|-------------|-------|---------|17| A1 | **BOLA** (Broken Object Level Authorization) | Can user A access user B's resources? | Verify object ownership at every endpoint |18| A2 | **Broken Authentication** | Weak passwords, unlimited login attempts? | bcrypt (cost 12+), rate limit, MFA |19| A3 | **Broken Object Property Level Authorization** | Are hidden fields exposed in responses? | Response DTOs, field-level filtering |20| A4 | **Unrestricted Resource Consumption** | Can mass requests crash the server? | Rate limiting, enforce pagination limits |21| A5 | **Broken Function Level Authorization** | Can regular users call admin APIs? | RBAC middleware, permission checks |22| A6 | **SSRF** (Server-Side Request Forgery) | Can URL input access internal resources? | URL whitelist, block internal IPs |23| A7 | **Security Misconfiguration** | Debug mode, default accounts exposed? | Separate prod config, inspect headers |24| A8 | **Lack of Automated Threat Protection** | Can APIs be called in abnormal sequences? | State machine validation, business rules |25| A9 | **Improper Asset Management** | Unused APIs, old versions exposed? | API inventory, version deprecation |26| A10 | **Unsafe API Consumption** | Are external API responses trusted blindly? | Validate external responses, set timeouts |2728## Authentication Checklist2930### Password Policy31- Minimum 8 characters, show strength meter (not strict rules)32- bcrypt (cost factor 12+) or Argon2id33- Temporary lock after 5 failed attempts (15 min) or CAPTCHA34- Prevent reuse of last 5 passwords3536### JWT Configuration37| Setting | Recommended Value |38|---------|------------------|39| Access Token Expiry | 15-30 minutes |40| Refresh Token Expiry | 7-14 days |41| Algorithm | RS256 (asymmetric) or HS256 |42| Storage | httpOnly + secure + sameSite cookie |43| Payload | Minimal: userId, role only (no PII) |44| Renewal | Silent refresh or token rotation |4546### Session Security47- Regenerate session ID after login48- Invalidate session on logout (server-side)49- Set session timeout (30 min idle)50- Bind session to IP/User-Agent (optional, strict)5152## HTTP Security Headers5354| Header | Value | Purpose |55|--------|-------|---------|56| `Strict-Transport-Security` | `max-age=31536000; includeSubDomains` | Force HTTPS |57| `X-Content-Type-Options` | `nosniff` | Prevent MIME sniffing |58| `X-Frame-Options` | `DENY` or `SAMEORIGIN` | Prevent clickjacking |59| `Content-Security-Policy` | `default-src 'self'` | Prevent XSS |60| `Referrer-Policy` | `strict-origin-when-cross-origin` | Limit referrer |61| `Permissions-Policy` | `camera=(), microphone=()` | Restrict browser features |6263## Input Validation Checklist6465| Type | Method | Tool |66|------|--------|------|67| Schema validation | Type + structure check | Zod, Joi, pydantic, Go validator |68| Length limits | Min/max constraints | Schema definitions |69| SQL Injection | Parameterized queries | ORM (Prisma, GORM, SQLAlchemy) |70| XSS Prevention | HTML escaping | DOMPurify (client), server escape |71| Path Traversal | Path normalization | filepath.Clean + whitelist |72| File Upload | Type + size validation | MIME type + magic number check |73| CORS | Origin whitelist | Never `origin: '*'` with credentials |7475## Sensitive Data Handling7677| Data Type | Storage | Transmission | Logging |78|----------|---------|-------------|---------|79| Passwords | bcrypt hash only | HTTPS only | NEVER |80| API Keys | Environment variables | Header (Authorization) | Masked (first 4 chars) |81| PII | Encrypted (AES-256) | HTTPS only | Masked |82| Credit Cards | Tokenized (payment provider) | Provider SDK | NEVER |83| Sessions | httpOnly cookie | HTTPS only | NEVER |8485## Security Review Severity Levels8687| Level | Label | Action | Example |88|-------|-------|--------|---------|89| P0 | CRITICAL | Block release | SQL injection, auth bypass |90| P1 | HIGH | Fix before merge | Missing authorization check |91| P2 | MEDIUM | Fix within sprint | Weak password policy |92| P3 | LOW | Track in backlog | Missing security header |9394<!-- moai:evolvable-start id="rationalizations" -->95## Common Rationalizations9697| Rationalization | Reality |98|---|---|99| "This is an internal application, OWASP does not apply" | Internal applications are reachable from compromised internal services. OWASP applies to all web applications. |100| "The framework handles XSS protection" | Frameworks protect default rendering paths. Dynamic HTML insertion, innerHTML, and template literals bypass the protection. |101| "We do not store sensitive data, so encryption is unnecessary" | Session tokens, API keys, and PII are sensitive data. If the application has users, it has sensitive data. |102| "Security headers are just defense-in-depth, not critical" | Each security header blocks a specific attack class. Missing CSP enables XSS even when output is escaped. |103| "I will do a security review before release" | Late security reviews find issues that are expensive to fix. Secure coding practices prevent them from the start. |104105<!-- moai:evolvable-end -->106107<!-- moai:evolvable-start id="red-flags" -->108## Red Flags109110- User input rendered in HTML without escaping or sanitization111- SQL query built with string concatenation instead of parameterized queries112- Authentication token stored in localStorage instead of httpOnly cookie113- Missing Content-Security-Policy header on response114- Secrets (API keys, passwords) found in source code or configuration files committed to git115116<!-- moai:evolvable-end -->117118<!-- moai:evolvable-start id="verification" -->119## Verification120121- [ ] OWASP Top 10 checklist reviewed for the change (show which items were evaluated)122- [ ] User input sanitized before rendering in HTML output123- [ ] All database queries use parameterized statements124- [ ] Security headers present (CSP, X-Frame-Options, X-Content-Type-Options)125- [ ] No secrets found in source code (show grep results for common secret patterns)126- [ ] Authentication tokens use httpOnly, Secure, SameSite cookie attributes127128<!-- moai:evolvable-end -->