deckhearth/pages
Randall Stillwell 258e479dc5 fix(auth): remove synthetic-admin bypass (Brief 2 of fix-auth-bypass)
Closes AGENTS.md gotcha #2: getUserFromRequest no longer returns a
hardcoded { userId: 1, email: 'admin@tcgvault.com', role: 'admin' }
when the Authorization header is missing or malformed.

lib/permission-middleware.js
  - getUserFromRequest now returns null for missing/malformed Bearer
    headers. No console.warn, no NODE_ENV gate — the fallback is gone,
    period.
  - Token-verify path and DB lookup unchanged.

pages/api/auth/verify.js
  - No-token branch now returns 401 instead of fetching the seed admin
    via `WHERE email = 'admin@tcgvault.com'`. Closes the admin-record-
    leak side of the same bypass.
  - JWT-verify branch unchanged.

Known follow-up (flagged but NOT addressed in this PR):
  pages/api/collections/[identifier]/cards.js POST/PUT/DELETE handlers
  dereference user.userId without a null guard. Previously masked by
  the synthetic admin (anonymous-write-as-admin on collections owned
  by user 1 was the security hole). Now degrades to NPE → 500 instead
  of a clean 401. Security is improved either way; cosmetic 500-vs-401
  fix lives in a separate one-line follow-up PR.

Convoy: fix-auth-bypass / Brief 2
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-23 10:57:23 -05:00
..
admin Fixed SSR and null user issues for production deployment 2025-07-24 17:04:06 -05:00
api fix(auth): remove synthetic-admin bypass (Brief 2 of fix-auth-bypass) 2026-05-23 10:57:23 -05:00
card Major Scanner Improvements 2025-07-29 14:19:48 -05:00
collection Major Scanner Improvements 2025-07-29 14:19:48 -05:00
community Major Scanner Improvements 2025-07-29 14:19:48 -05:00
deck Major Scanner Improvements 2025-07-29 14:19:48 -05:00
invite 🎉 COMPLETED: Full Collaborative Collections System 2025-07-25 08:34:28 -05:00
_app.js Major redesign: Enhanced card display with particle effects, improved filters, and search functionality 2025-07-23 21:26:54 -05:00
cards.js Major Scanner Improvements 2025-07-29 14:19:48 -05:00
collections.js 🔧 Fix System Collections & Database Schema Issues 2025-07-27 19:17:55 -05:00
dashboard.js Major Scanner Improvements 2025-07-29 14:19:48 -05:00
deck-builder.js Major Scanner Improvements 2025-07-29 14:19:48 -05:00
decks.js Major Scanner Improvements 2025-07-29 14:19:48 -05:00
index.js Major Scanner Improvements 2025-07-29 14:19:48 -05:00
login.js Clean Up Login & Add Signup Flow 2025-07-28 11:09:58 -05:00
logout.js 🎨 Restructured Layout System 2025-07-25 11:28:04 -05:00
my-cards.js Major Scanner Improvements 2025-07-29 14:19:48 -05:00
profile.js 🎯 Build Comprehensive User Profile & Settings System 2025-07-26 18:05:55 -05:00
scanner.js Marker: Fixed card queue property mismatch - cards now properly separate in scanner queue 2025-08-01 17:41:42 -05:00
settings.js 🎯 Build Comprehensive User Profile & Settings System 2025-07-26 18:05:55 -05:00
signup.js 🎨 Enhanced Signup with Username & Profile Images 2025-07-28 11:18:58 -05:00