Skip to content

About

SecureBank is a university Application Security project simulating a secure banking web application, featuring protection against XSS and SQL injection, two-factor authentication (2FA), password hashing, access control, account freezing, and secure transaction handling.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Secure Web Application - [Secure Bank System]

Description

SecureBank is a small, security-focused banking web application built for an application security course. It is split into a FastAPI backend and a static HTML/CSS/JavaScript frontend. The system demonstrates core banking flows (authentication, accounts, transactions) with security features such as JWT-based sessions, MFA, rate limiting, and audit logging.

Tech Stack

  • Frontend : [HTML, CSS, Vanilla JavaScript]

  • Backend :

    • Language: Python
    • Web framework: FastAPI
    • ASGI server: Uvicorn
    • Database: PostgreSQL
    • ORM: SQLAlchemy
    • Migrations: Alembic
    • Data validation: Pydantic, pydantic-settings
    • Auth & security: JWT (python-jose), bcrypt, cryptography (AES-256)
    • MFA/TOTP: pyotp, qrcode
    • Rate limiting: slowapi
    • Utilities: python-dotenv, python-multipart

Core features

  • User Login
  • Role-based access: Admin/User
  • Authentication with JWT access tokens.
  • Optional MFA (TOTP) for sensitive actions or thresholds.
  • Account and transaction management endpoints.
  • Admin and auditor views with dedicated pages.
  • Audit log access for monitoring and compliance.
  • Security headers and CORS controls at the API layer.
  • Rate limiting and lockout logic for failed logins.
  • STRIDE & DREAD security modeling
  • Code scanning using CodeQL,Bandit

🔒 Security Implementations

  • Input Validation: Pydantic schemas with field validators for email, password rules, OTP, and amounts.

  • Output Sanitization: Transfer note sanitization strips HTML before storage.

  • Password Hashing: bcrypt for password hashing and verification.

  • Encryption: AES-256-CBC for sensitive fields (balances, amounts).

  • Session Management: JWT access tokens with expiry, refresh tokens stored as HttpOnly cookies, and token blacklist on logout.

  • Headers: CSP, HSTS, X-Frame-Options, X-Content-Type-Options, and other security headers set in the API middleware.

  • CORS and rate limiting setup: CORS allowlist plus SlowAPI rate limiting.

  • Role-based Authorization: Role checks enforced via middleware dependencies (Customer/Manager/Auditor).

Threat Modeling

See docs/STRIDE Threat Model.md See docs/DREAD Risk Assessment.md


Code Scanning Tools Used

  • GitHub CodeQL
  • Bandit

Reports/screenshots are included in the scans/ directory.

Deployment

Instructions:

install Database

sudo apt install postgresql postgresql-contrib -y

Python packages

Install from requirements.txt with this command : 

pip install --break-system-packages -r requirements.txt

to run

in setting.py please set in "env_file"          : ".env",

Data base : sudo service postgresql start

add test data on it : run python SRC\securebank-python\seed.py

backend : uvicorn main:app --reload --port 5000 --host 0.0.0.0

in SRC\securebank-python


Frontend : python -m http.server 8000 --bind 0.0.0.0 

in SRC\securebank-frontend


About

SecureBank is a university Application Security project simulating a secure banking web application, featuring protection against XSS and SQL injection, two-factor authentication (2FA), password hashing, access control, account freezing, and secure transaction handling.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages