--- name: security-checklist description: Security review checklist — injection (SQL, XSS, CSRF), auth flaws, secrets in code, dependency CVEs, input validation. Use before deploying or during code review to catch vulnerabilities early. license: MIT --- ## What I do Review code for security vulnerabilities before committing. ## Checklist ### Input Validation - [ ] User inputs validated - [ ] Length limits enforced - [ ] Special characters sanitized ### Authentication - [ ] Passwords hashed (Argon2/bcrypt, not MD5/SHA) - [ ] Session tokens secure - [ ] No hardcoded credentials ### Authorization - [ ] RBAC implemented - [ ] Users access only own data - [ ] Admin endpoints protected ### Data Protection - [ ] Sensitive data encrypted at rest - [ ] TLS for data in transit - [ ] Secrets in env vars, not code ### Dependencies - [ ] Up to date - [ ] No known vulnerabilities - [ ] Lock files committed ### Error Handling - [ ] No sensitive info in errors - [ ] Stack traces hidden - [ ] Rate limiting on failed attempts ### API Security - [ ] Rate limiting - [ ] SQL injection prevented - [ ] Parameterized queries ### Secrets - [ ] No secrets in code - [ ] Rotated regularly ## Common Vulnerabilities ### SQL Injection ```go // Bad query := fmt.Sprintf("SELECT * FROM users WHERE id = %s", id) // Good query := "SELECT * FROM users WHERE id = $1" db.Query(query, id) ``` ### Format String ```c // Bad printf(user_input); // Good printf("%s", user_input); ``` ### Buffer Overflow ```c // Bad strcpy(dest, src); // Good strncpy(dest, src, sizeof(dest) - 1); dest[sizeof(dest) - 1] = '\0'; ``` ## Tools ```bash # Rust cargo audit cargo deny check # Go go vet ./... # C gcc -fsanitize=address # Secrets gitleaks detect ``` ## Before Deploy - [ ] Full security scan - [ ] Env vars verified - [ ] SSL/TLS valid - [ ] Security headers configured --- Use before every commit.