A secure user registration and authentication system built using Python Flask with cybersecurity-focused validation and authentication practices.
This project demonstrates how to build a secure web form and authentication system using:
- Python
- Flask
- SQLite
- bcrypt
- HTML
- Linux CLI workflow
- Git & GitHub
The project focuses on secure backend engineering concepts including:
- input validation
- password hashing
- SQL injection prevention
- authentication
- session handling
- secure database interaction
Users can:
- register securely
- validate inputs
- store credentials safely
Authenticated users can:
- login securely
- access protected dashboard
- logout safely
Validation is implemented for:
- Name
- Student ID
- Password
Passwords are hashed using:
- bcrypt
Plain-text passwords are never stored.
Parameterized queries are used:
cursor.execute(
"SELECT * FROM users WHERE email = ?",
(email,)
)This prevents SQL injection attacks.
Flask sessions are used to:
- maintain authenticated state
- protect restricted routes
SQLite UNIQUE constraint prevents duplicate account registration.
| Technology | Purpose |
|---|---|
| Python | Backend language |
| Flask | Web framework |
| SQLite | Database |
| bcrypt | Password hashing |
| HTML | Frontend |
| Git | Version control |
| GitHub | Remote repository |
| Linux CLI | Development workflow |
secure_form_project/
│
├── app.py
├── requirements.txt
├── README.md
├── .gitignore
│
├── templates/
│ ├── index.html
│ └── login.html
│
├── static/
│
└── users.dbgit clone https://github.com/Madhura7s/secure-flask-form.gitcd secure-flask-formpython3 -m venv venvsource venv/bin/activatevenv\Scripts\activatepip install -r requirements.txtpython3 app.pyOpen browser:
http://127.0.0.1:5000
User Input
↓
Validation
↓
Password Hashing
↓
Database Storage
↓
Login Authentication
↓
Session Creation
↓
Protected Dashboard Access
| Threat | Protection |
|---|---|
| SQL Injection | Parameterized queries |
| Weak Passwords | Regex validation |
| Credential Theft | bcrypt hashing |
| Unauthorized Access | Session validation |
| Duplicate Accounts | UNIQUE constraints |
| Invalid Input | Regex filtering |
Planned security enhancements:
- CSRF protection
- Rate limiting
- HTTPS
- Secure cookies
- Docker support
- Admin panel
- Logging & monitoring
- Role-based access control
- JWT authentication
This project was built to practice:
- secure backend development
- cybersecurity thinking
- Linux-based development workflow
- authentication systems
- secure database interaction
- Git & GitHub workflow
Madhura Suryawanshi
Cybersecurity & Secure Development Enthusiast