Skip to content

About

A secure web application built with HTML, CSS, JavaScript, Python, and PostgreSQL, focused on identifying and fixing common web security vulnerabilities.

Resources

Stars

5 stars

Watchers

0 watching

Forks

Latest commit

 

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

CodeAlpha Logo



Secure Coding Review



About the Project

A Faculty Secure Portal built twice: first full of real-world security mistakes, then rebuilt after a proper security audit. Placing both versions side by side shows exactly how an attack works and how the fix stops it.


Vulnerable App to Security Audit to Security Fixes to Secure App


Warning

The vulnerable version is intentionally insecure. Run it only on your own machine for testing. Never deploy it.




Vulnerable vs Secure

Security Area Vulnerable Version Secure Version
Passwords Stored as plaintext Hashed
SQL Queries Injection risk Parameterized queries
CSRF No protection Token validation
OTP Stored as plaintext Hashed
File Upload Weak validation Type, size and content checks
Sessions Default settings Secure cookies
Rate Limiting Missing Login and OTP throttling
Security Headers Limited Enabled
Debug Mode Enabled Disabled
Secrets Weak fallback Environment variables



See the Difference

SQL Injection Example

Click to expand
# Vulnerable: user input goes straight into the query
query = f"SELECT * FROM users WHERE username = '{username}'"

# Secure: parameterized query
db.execute("SELECT * FROM users WHERE username = ?", (username,))

Entering ' OR '1'='1 in the login form logs you in on the vulnerable version. The secure version rejects it.




Tech Stack

Layer Technology
Frontend HTML, CSS, JavaScript
Backend Python, Flask
Database SQLite
Environment Local security lab



Project Structure

CodeAlpha-SecureWeb-App/
├── assets/
│   ├── CodeAlpha-logo.png
│   └── flow.svg
├── vulnerable/
│   ├── frontend/
│   └── backend/
│       └── v-app.py
└── secure/
    ├── frontend/
    └── backend/
        └── s-app.py



Getting Started

1. Clone the repository

git clone https://github.com/<your-username>/CodeAlpha-SecureWeb-App.git
cd CodeAlpha-SecureWeb-App

2. Install dependencies

pip install flask

3. Run the vulnerable version (local testing only)

python vulnerable/backend/v-app.py

4. Run the secure version

export SECRET_KEY="your-long-random-secret"
python secure/backend/s-app.py



Disclaimer

This project is for educational and authorized security testing only. The author is not responsible for misuse.

About

A secure web application built with HTML, CSS, JavaScript, Python, and PostgreSQL, focused on identifying and fixing common web security vulnerabilities.

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages