一键导入
django-security
Use this skill when analyzing Django applications for framework-specific security issues and best practices.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use this skill when analyzing Django applications for framework-specific security issues and best practices.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use this skill when analyzing Django applications for OWASP 2025 A01: Broken Access Control and Broken Object-Level Authorization (BOLA) vulnerabilities.
Use this skill when analyzing code for OWASP Top 10 vulnerabilities. Provides structured guidance for identifying common web application security risks.
Use this skill to generate structured, professional security assessment reports in JSON format.
| name | django-security |
| description | Use this skill when analyzing Django applications for framework-specific security issues and best practices. |
| license | MIT |
| metadata | {"author":"absoluteappsec","version":"1.0"} |
This skill provides expertise on Django's security features and common Django-specific vulnerabilities.
When analyzing Django applications, pay special attention to:
Check for proper use of decorators:
@login_required - ensures user is authenticated@permission_required - checks specific permissions@user_passes_test - custom authorization logicLook for missing authorization on views that modify data. Verify request.user ownership is validated before operations.
SAFE - Django ORM methods automatically escape:
Model.objects.filter()Model.objects.get()Model.objects.exclude()UNSAFE - These can have SQL injection:
.raw() with string formatting.extra() with user inputcursor.execute() with concatenationExample vulnerable pattern:
# BAD: SQL Injection
User.objects.raw("SELECT * FROM users WHERE name = '%s'" % name)
# GOOD: Parameterized
User.objects.raw("SELECT * FROM users WHERE name = %s", [name])
|safe filter misuse on user inputmark_safe() on untrusted data{% autoescape off %} blocks don't include user content{% csrf_token %} in all POST forms@csrf_exempt decorators (should be rare and justified)Check settings.py for:
DEBUG = False in productionSECRET_KEY not hardcoded (use environment variables)ALLOWED_HOSTS properly configuredSESSION_COOKIE_SECURE = TrueCSRF_COOKIE_SECURE = TrueSECURE_SSL_REDIRECT = True# BAD: IDOR - No ownership check
def delete_item(request, item_id):
Item.objects.filter(id=item_id).delete()
# GOOD: Ownership verified
def delete_item(request, item_id):
Item.objects.filter(id=item_id, owner=request.user).delete()
# BAD: XSS via mark_safe
return mark_safe(user_input)
# BAD: Open redirect
return redirect(request.GET.get('next'))
# GOOD: Validate redirect URL
from django.utils.http import url_has_allowed_host_and_scheme
next_url = request.GET.get('next')
if url_has_allowed_host_and_scheme(next_url, allowed_hosts={request.get_host()}):
return redirect(next_url)
For each Django-specific finding, note: