django-security

Implements Django security practices for authentication, authorization, CSRF, XSS, and SQL injection prevention.

Updated May 19, 2026
One-click install
npx skills add https://github.com/azusagasaku/--claude-config --skill django-security-azusagasaku
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: django-security
Source: https://github.com/azusagasaku/--claude-config/tree/main/skills/ecc/django-security
Command: npx skills add https://github.com/azusagasaku/--claude-config --skill django-security-azusagasaku

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Django applications face common web vulnerabilities like SQL injection, XSS, CSRF attacks, and weak authentication when security settings are misconfigured or overlooked during development and deployment. ## Core Features & Use Cases - Production Security Configuration: Provides hardened settings for HTTPS, HSTS, secure cookies, password validators, and environment-based secret management. - Authentication & Authorization Patterns: Covers custom user models, Argon2 password hashing, RBAC, permission mixins, and DRF permission classes. - Attack Prevention: Demonstrates safe ORM usage against SQL injection, template escaping against XSS, CSRF token handling, file upload validation, and API rate limiting. - Use Case: When deploying a Django application to production, use this Skill to audit your settings.py, configure security headers and CSP middleware, and verify the included security checklist before going live. ## Quick Start Review my Django project's settings and views for security issues and apply production-grade security configurations.

Frequently Asked Questions about django-security

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I secure a Django application for production?▼

Set DEBUG to False, configure ALLOWED_HOSTS, enable SECURE_SSL_REDIRECT and HSTS, and use secure cookies for sessions and CSRF. Store SECRET_KEY in environment variables and enable all password validators with a minimum length of 12.

How to prevent SQL injection in Django queries?▼

Django's ORM automatically escapes parameters, so use filter() and get() methods instead of raw SQL. If raw queries are necessary, always pass user input as parameterized arguments to raw(), never through string interpolation.

What password hasher should Django use for stronger security?▼

Configure Argon2PasswordHasher as the first entry in PASSWORD_HASHERS for stronger security than the default PBKDF2. Django will use the first hasher for new passwords while still verifying older hashes from the remaining entries.

Does Django protect against XSS attacks by default?▼

Yes, Django templates auto-escape variables by default, preventing most XSS attacks. Avoid using the safe filter or mark_safe() with user input, and use format_html() or escape() when building HTML strings programmatically.

How do I add rate limiting to Django REST Framework APIs?▼

Configure DEFAULT_THROTTLE_CLASSES with AnonRateThrottle and UserRateThrottle in REST_FRAMEWORK settings, then define rates like '100/day' for anonymous users. Create custom throttle classes by subclassing UserRateThrottle with a scope and rate.

When should I use csrf_exempt in Django views?▼

Use csrf_exempt only when absolutely necessary, such as receiving webhooks from external services that cannot include a CSRF token. Keep CSRF protection enabled for all regular form submissions and AJAX requests using the X-CSRFToken header.