- Add SetupGuard component: redirects to /setup if setup not complete, shown as spinner while loading. All routes except /setup now wrapped. - SetupPage redirects to /login on mount when setup already done. - Fix async blocking: offload bcrypt.hashpw and bcrypt.checkpw to run_in_executor so they never stall the asyncio event loop. - Hash password with SHA-256 (SubtleCrypto) before transmission; added src/utils/crypto.ts with sha256Hex(). Backend stores bcrypt(sha256). - Add Makefile with make up/down/restart/logs/clean targets. - Add tests: _check_password async, concurrent bcrypt, expired session, login-without-setup, run_setup event-loop interleaving. - Update Architekture.md and Features.md to reflect all changes.
2.3 KiB
BanGUI — Task List
This document breaks the entire BanGUI project into development stages, ordered so that each stage builds on the previous one. Every task is described in prose with enough detail for a developer to begin work. References point to the relevant documentation.
✅ DONE — Issue: Setup forward
Problem: No DB present did not forward to setup page; setup page was not redirecting to login when already done.
Fix:
- Added
SetupGuardcomponent (src/components/SetupGuard.tsx) that callsGET /api/setupon mount and redirects to/setupif not complete. - All routes except
/setupare now wrapped inSetupGuardinApp.tsx. SetupPagecallsGET /api/setupon mount and redirects to/loginif already complete.
✅ DONE — Issue: Setup - Error during setup (500)
Problem: POST /api/setup returned 500 on some runs.
Root cause: bcrypt.hashpw and bcrypt.checkpw are CPU-bound blocking calls. Running them directly in an async FastAPI handler stalls the event loop under concurrent load, causing timeouts / 500 responses.
Fix:
setup_service.run_setupnow offloads bcrypt hashing toloop.run_in_executor(None, ...).auth_service._check_passwordwas converted from a sync to an async function, also usingrun_in_executor.
✅ DONE — Issue: Setup - Security issue (password in plaintext)
Problem: master_password was transmitted as plain text in the POST /api/setup and POST /api/auth/login request bodies.
Fix:
- Added
src/utils/crypto.tswith asha256Hex(input)helper using the browser-nativeSubtleCryptoAPI. SetupPage.handleSubmitnow SHA-256 hashes the password before submission.api/auth.ts login()now SHA-256 hashes the password before the login POST.- The backend stores
bcrypt(sha256(password)). The plaintext never leaves the browser.
✅ DONE — Clean command
Problem: No easy way to wipe all debug compose volumes and start fresh.
Fix: Added Makefile at the project root with targets:
make up— start the debug stack (detached)make down— stop the debug stackmake restart— restart the debug stackmake logs— tail all logsmake clean—compose down -v --remove-orphans(removes all debug volumes)