A security-focused task management web application built with Django 6.0, demonstrating OWASP Top 10 compliance and secure coding practices .
Project Overview
Features
Security Implementation
OWASP Compliance Matrix
Installation & Setup
Usage Guide
Project Structure
Security Testing Results
Screenshots
Dependencies
This application implements a secure task management system where users can create, read, update, and delete (CRUD) their personal tasks. The application enforces strict access controls, ensuring users can only manage their own tasks while administrators have oversight capabilities.
Component
Technology
Framework
Django 6.0 (Python)
Database
SQLite (Development) / PostgreSQL (Production)
Authentication
Django Auth + django-axes
Password Hashing
Argon2 (OWASP Recommended)
Frontend
Bootstrap 5.3 with SRI
Feature
Description
π Registration
Create account with password validation
π Login/Logout
Secure authentication with rate limiting
β
Task Management
Create, view, edit, delete personal tasks
π€ Profile
View account info and task statistics
Feature
Description
ποΈ View All Tasks
Oversight of all user tasks
π Audit Log
Security event monitoring
βοΈ Admin Panel
Django admin interface
β
Argon2 Password Hashing (OWASP recommended)
β
Role-Based Access Control (RBAC)
β
Login Rate Limiting (5 attempts, 2-min lockout)
β
Session Timeout (30 minutes)
β
CSRF Protection on all forms
β
SQL Injection Prevention via Django ORM
β
XSS Prevention via template auto-escaping
β
Custom Error Pages (no information disclosure)
β
Comprehensive Audit Logging
β
Content Security Policy (CSP)
β
Subresource Integrity (SRI) on CDN resources
π Security Implementation
1. Input Validation (OWASP ASVS V5)
# Server-side validation using Django Forms
class TaskForm (forms .ModelForm ):
def clean_title (self ):
title = self .cleaned_data .get ('title' , '' ).strip ()
if len (title ) < 1 :
raise forms .ValidationError ("Title cannot be empty." )
return title
def clean_due_date (self ):
due_date = self .cleaned_data .get ('due_date' )
if due_date and due_date < timezone .now ().date ():
raise forms .ValidationError ("Date already passed." )
return due_date
2. Authentication & Session Management (OWASP ASVS V2)
# settings.py - Security Configuration
PASSWORD_HASHERS = ['django.contrib.auth.hashers.Argon2PasswordHasher' , ...]
SESSION_COOKIE_AGE = 1800 # 30 minutes
SESSION_COOKIE_HTTPONLY = True
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
# Rate Limiting with django-axes
AXES_FAILURE_LIMIT = 5
AXES_COOLOFF_TIME = 2 / 60 # 2 minutes
3. Access Control (OWASP ASVS V4)
# RBAC Implementation in Views
class TaskUpdateView (LoginRequiredMixin , UserPassesTestMixin , UpdateView ):
def test_func (self ):
task = self .get_object ()
# Only owner or admin can update
return self .request .user == task .owner or self .request .user .is_staff
4. Error Handling (OWASP ASVS V7)
# Custom error handlers - No stack traces exposed
handler400 = 'securetaskapp.views.custom_400'
handler403 = 'securetaskapp.views.custom_403'
handler404 = 'securetaskapp.views.custom_404'
handler500 = 'securetaskapp.views.custom_500'
5. Audit Logging (OWASP ASVS V7)
# Automatic logging via Django signals
@receiver (user_logged_in )
def log_successful_login (sender , user , request , ** kwargs ):
AuditLog .objects .create (
user = user ,
action = 'LOGIN_SUCCESS' ,
ip_address = request .META .get ('REMOTE_ADDR' ),
details = f"Login via { request .META .get ('HTTP_USER_AGENT' )} "
)
π OWASP Compliance Matrix
OWASP Top 10 2021
Risk
Mitigation
Status
A01
Broken Access Control
LoginRequiredMixin, UserPassesTestMixin, owner filtering
β
A02
Cryptographic Failures
Argon2 hashing, HTTPS-ready cookies
β
A03
Injection
Django ORM, parameterized queries, form validation
β
A04
Insecure Design
Secure-by-default, input whitelisting
β
A05
Security Misconfiguration
DEBUG=False, custom error pages, security headers
β
A06
Vulnerable Components
Snyk scanning, minimal dependencies
β
A07
Auth Failures
Rate limiting, session timeout, strong hashing
β
A08
Integrity Failures
CSRF tokens, SRI on CDN resources
β
A09
Logging Failures
Comprehensive audit logging
β
A10
SSRF
No external URL fetching
N/A
π Installation & Setup
Python 3.10 or higher
pip (Python package manager)
Virtual environment support
Step-by-Step Installation
# 1. Clone the repository
git clone < repository-url>
cd secure-task-manager
# 2. Create virtual environment
python -m venv venv
source venv/bin/activate # Linux/Mac
# or: venv\Scripts\activate # Windows
# 3. Install dependencies
pip install -r requirements.txt
# 4. Configure environment (optional)
cp env.example .env
# Edit .env with your settings
# 5. Run database migrations
python manage.py migrate
# 6. Create admin user
python manage.py createsuperuser
# 7. Run development server
DJANGO_DEBUG=True python manage.py runserver
Register a new account at /register/
Login with your credentials
Create tasks with title, description, status, and due date
Manage tasks - edit or delete your own tasks
View profile to see your task statistics
Login with an admin account (is_staff=True)
View all tasks from all users
Access audit log to monitor security events
Use admin panel for user management
Testing Security Features
Test
Steps
Rate Limiting
Enter wrong password 5 times β See lockout page
Access Control
Try accessing another user's task β 403 Forbidden
Error Pages
Visit invalid URL β Custom 404 page (DEBUG=False)
CSRF
Disable cookies, submit form β CSRF error
secure-task-manager/
βββ securetaskapp/ # Main Django project
β βββ settings.py # Security configurations
β βββ urls.py # URL routing + error handlers
β βββ views.py # Custom error handlers
β βββ templates/ # Global templates
β βββ base.html # Base template with CSP & SRI
β βββ 400.html # Bad Request error
β βββ 403.html # Forbidden error
β βββ 404.html # Not Found error
β βββ 500.html # Server Error
β βββ registration/ # Auth templates
β
βββ tasks/ # Task management app
β βββ models.py # Task model with owner FK
β βββ views.py # CRUD views with RBAC
β βββ forms.py # Input validation
β βββ templates/tasks/ # Task templates
β
βββ auditlog/ # Security logging app
β βββ models.py # AuditLog model
β βββ signals.py # Auth event handlers
β βββ apps.py # Signal registration
β
βββ requirements.txt # Python dependencies
βββ env.example # Environment template
βββ manual_code_review_checklist.md # Security checklist
βββ bandit_report.txt # SAST results
βββ snyk_code_report.json # Code analysis
βββ snyk_dependency_report.json # Dependency scan
βββ README.md # This file
π§ͺ Security Testing Results
Run started: 2026-01-18
Test results:
No issues identified.
Total lines of code: 432
Total issues: 0 (High: 0, Medium: 0, Low: 0)
Dependency Scanning (Snyk)
Testing secure-task-manager...
β Tested 8 dependencies for known issues
β No vulnerable paths found
Dynamic Testing (OWASP ZAP)
Risk Level
Count
High
0
Medium
0
Low
2 (Informational)
Clean login form with CSRF protection
Rate limiting active (django-axes)
User sees only their own tasks
Admin sees all tasks with owner info
Login success/failure events
Task CRUD operations
IP addresses captured
Package
Version
Purpose
Django
β₯5.0, <7.0
Web framework
django-axes
β₯8.0.0
Login rate limiting
argon2-cffi
β₯23.1.0
Password hashing
pip install -r requirements.txt
Variable
Description
Default
DJANGO_SECRET_KEY
Secret key for crypto
dev-only-key
DJANGO_DEBUG
Debug mode
False
DJANGO_ALLOWED_HOSTS
Allowed hostnames
127.0.0.1,localhost
Field
Value
Course
Secure Software Development
Project
Secure Microservice-Based Web Application
Framework
Django 6.0 (Python)
This project is for educational purposes as part of the Secure Software Development course.