How gargmradul09/password_security_tool works
Project type and purpose
• This is a full-stack web application (“Password Security & Leak Detection Tool”).
• Purpose: let users enter passwords, evaluate strength (entropy), and check compromise status via Have I Been Pwned (HIBP) API without ever storing the raw password.
High-level file-structure analysis
• app.py: main Flask application / routing entry point
• breach_detection.py, password_hashing.py, password_security.py: core business-logic modules
• config.py: environment/configuration settings (e.g., HIBP key, rate-limit config)
• database.db, passwords.db, instance/passwords.db: SQLite stores (e.g., usage logs, rate-limiting counters)
• templates/*.html + index.html: presentation layer (user interface)
• Procfile & requirements.txt: deployment and dependency specs
Key insights from the README
• Backend: Python+Flask with SHA-1 k-anonymity to query HIBP
• Frontend: HTML/CSS/JS served either by Flask or via Vercel
• No raw-password persistence—privacy-first design
• Hosted on Render (backend) and Vercel (frontend)
• Security: rate-limiting, one-way hashing
a. Components
• User’s Web Browser (UI)
• Frontend (static HTML/CSS/JS)
• Flask Backend (app.py + service modules)
• SQLite Databases (instance/passwords.db, database.db)
• External Service: Have I Been Pwned (HIBP) API
• Configuration Store (config.py + instance folder)
• Deployment Platforms (Render, Vercel)
b. Relationships & Data Flows
1. User submits password → Frontend JS/form
2. HTTP POST → Flask Backend route (app.py)
3. app.py invokes password_hashing.py → compute SHA-1 prefix
4. breach_detection.py calls HIBP API (external HTTPS request)
5. HIBP responds with suffix list → breach_detection.py parses result
6. password_security.py evaluates entropy + breach result
7. Backend persists any rate-limit counters or logs to SQLite
8. Flask returns JSON or rendered template to Frontend
9. Frontend displays strength/breach status
c. Architectural patterns & design principles
• Layered architecture: Presentation Layer (templates),
Business-Logic Layer (service modules), Data Layer (SQLite)
• k-Anonymity design: secure‐by‐design pattern for external API calls
• Separation of concerns: routing vs. hashing vs. breach logic vs. config
• Minimal surface area: no raw‐password storage, ephemeral operations
d. Key technologies & frameworks
• Flask (routing + templating)
• Jinja2 templates (HTML views)
• Python modules for hashing & HTTP requests (requests library)
• SQLite (lightweight file‐based database)
• HIBP REST API (external service)
• Deployment: Render (backend) + Vercel (frontend hosting)