Repository navigation
feat(auth): guest login, email registration/login, verification codes - #15
Conversation
🔍 Code Review — Request ChangesSummaryThree auth modes (guest, email login, email registration) with PBKDF2 password hashing, verification codes via Resend API, and domain allow-list. Large portion is unrelated Prettier formatting. Critical Issues1. Verification codes hashed with plain SHA-256 (no salt)
2.
3. No rate limiting on
4. No rate limiting on
5. JWT stored in IndexedDB with no HttpOnly cookie
6.
Warning Issues7. Recommendation: Request changes — fix PRNG, add per-IP rate limiting, add login brute-force protection, fix token refresh path. |
- Salted verification-code hashes; crypto.getRandomValues for codes - Per-IP rate limits on send-code and login (brute-force protection) - Require JWT_SECRET (no hardcoded fallback) - Nickname uniqueness via DB check on register and check-nickname API - Registered sessions use user_id + sessionStorage token; no guest token mint - Restore prefers-reduced-motion and light-mode CSS on login screens
Addressed review feedbackCritical
Warnings (key)
Deferred / residual
Ready for re-review. |
Status
No further code changes planned on this PR unless requested. |
Add registered accounts with email verification (Resend), guest sessions,
and password auth while keeping the admin panel intact.
- Worker: /api/auth/{guest,register,login,send-code,email-domains,token}
- Migrations 0015-0017: account_type, email/password, verification codes
- App: login screens + authStore for guest/registered flows
- PBKDF2 hashPassword; guest-only JWT refresh; allowed email domains
Requires KEY_RESEND (or RESEND_API_KEY) and EMAIL_FROM for send-code.
- Salted verification-code hashes; crypto.getRandomValues for codes - Per-IP rate limits on send-code and login (brute-force protection) - Require JWT_SECRET (no hardcoded fallback) - Nickname uniqueness via DB check on register and check-nickname API - Registered sessions use user_id + sessionStorage token; no guest token mint - Restore prefers-reduced-motion and light-mode CSS on login screens
1723783 to
c2e3f34
Compare
Replace /files 410 stubs with R2 CRUD (upload/list/quota/get/rename/delete) for registered accounts, add /api/sync data+quota, and dual-write from the file manager with optional sync-from-cloud. Depends on email auth (LemonStudio-hub#15) for accountType + requiredRegisteredUser. Ops: create R2 bucket bound as SCP_FILES (see wrangler.toml).
Replace /files 410 stubs with R2 CRUD (upload/list/quota/get/rename/delete) for registered accounts, add /api/sync data+quota, and dual-write from the file manager with optional sync-from-cloud. Depends on email auth (LemonStudio-hub#15) for accountType + requiredRegisteredUser. Ops: create R2 bucket bound as SCP_FILES (see wrangler.toml).
What
User authentication upgrade:
POST /api/auth/guest)send-code→register)POST /api/auth/login)POST /api/auth/token(guest-only)GET /api/auth/email-domainsauthStoresupport guest / register / login flows0015–0017:account_type+ ban fields, email/password columns, verification codes tableOut of scope (intentionally)
EMAIL_FROM)Ops / secrets
Worker needs:
KEY_RESENDorRESEND_API_KEY(Resend API key)EMAIL_FROM(defaults in wrangler vars:SCP OS <auth@daum.pw>— adjust for production)Base commits
Includes shared CI green base (scraper fetch + prettier) also carried by #13/#14 until those land on
main. After merge, rebase will shrink to auth-only.Verification
pnpm typecheck✅Note vs full local main
Extracted from local auth work; did not include admin deletion or cloud-sync migrations from personal branch.