A secure web application for managing notes, built with Flask and PostgreSQL.
- User registration and authentication
- Secure password hashing using Werkzeug
- Session-based authentication
- Modern, responsive UI with pure HTML/CSS
- Python 3.8 or higher
- PostgreSQL database
- pip (Python package manager)
- Clone the repository:
cd SecureNotes1- Create a virtual environment (recommended):
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set up environment variables (optional):
cp .env.example .env
# Edit .env and set your SECRET_KEY-
Ensure PostgreSQL is running and the database exists:
- Host: localhost
- Port: 5432
- Username: postgres
- Password: password
- Database: securenotes1
-
Run the application:
python app.pyThe application will be available at http://localhost:5000
- Password Hashing: Passwords are hashed using Werkzeug's secure password hashing (PBKDF2)
- Session Security:
- HTTP-only cookies (prevents XSS attacks)
- Secure cookies in production (HTTPS only)
- SameSite cookie attribute (CSRF protection)
- Input Validation: Username and password validation with length and character restrictions
- SQL Injection Protection: Using SQLAlchemy ORM with parameterized queries
- Timing Attack Prevention: Consistent error messages to prevent user enumeration
Before deploying to production:
- Set a strong
SECRET_KEYenvironment variable - Set
FLASK_ENV=productionto enable secure cookies - Use HTTPS/SSL certificates
- Configure a production WSGI server (e.g., Gunicorn)
- Set up proper database connection pooling
- Enable rate limiting for login/registration endpoints
- Set up logging and monitoring
- Use environment variables for sensitive configuration
SecureNotes1/
├── app.py # Main Flask application
├── requirements.txt # Python dependencies
├── templates/ # HTML templates
│ ├── base.html
│ ├── login.html
│ ├── register.html
│ └── dashboard.html
├── static/ # Static files
│ └── css/
│ └── style.css
├── .env.example # Example environment variables
├── .gitignore # Git ignore file
└── README.md # This file
id: Integer (Primary Key)username: String (Unique, Indexed)password_hash: String (Hashed password)created_at: DateTime (Auto-generated)
This project is open source and available for personal use.