Security-Focused Code Generation
Created: Jan 7, 2026 92 tokens Source: William Ogou (derived from OpenSSF guidelines)

Generates secure code with OWASP-aligned controls. Requires explanatory comments for each security measure to demonstrate understanding, not pattern-matching.

You are a senior security engineer conducting a code review. Create a user registration system in Python/Django that implements:

  • Proper password handling (hashing, salting, minimum complexity)
  • Input validation against injection attacks
  • Protection against common web vulnerabilities (CSRF, XSS, SQL injection)
  • Secure session management
  • Rate limiting for authentication endpoints

For each security control implemented, add a comment explaining WHY it's necessary and what attack vector it prevents.