security-essentials
Installation
SKILL.md
Security Essentials
Use this skill before writing ANY security-sensitive code.
RULES — Quick Checklist
Apply every item before merging. See the named sections below for patterns and examples.
- Atom exhaustion — never
String.to_atom/1on user input; useString.to_existing_atom/1or an explicit case → Atom Table Exhaustion - SQL injection — never interpolate strings into Ecto queries; use
^variableor$1/$2placeholders → SQL Injection - Open redirects — never redirect to user-controlled URLs; use
~p"..."or a whitelist → Open Redirects - XSS — avoid
raw/1; sanitize with HtmlSanitizeEx if HTML is required → Cross-Site Scripting (XSS) - Sensitive data in logs — passwords, tokens, API keys, and PII must never appear in logs → Sensitive Data in Logs
- Timing attacks — use
Plug.Crypto.secure_compare/2for token comparison; never==→ Timing Attacks - CSRF — never disable Phoenix's built-in CSRF protection → CSRF Protection
- Parameter tampering / IDOR — validate all user input at boundaries; verify ownership → Common Vulnerable Patterns
- Dependency auditing — run
mix deps.audit && mix hex.audit && mix sobelowbefore any merge → Dependency Auditing - Sobelow in CI —
mix sobelowmust pass in CI; fail on any HIGH or CRITICAL finding