Repository navigation
Rebuild Architecture - #1
Merged
Merged
Conversation
…stack Access control now lives in Postgres RLS instead of hand-written controller checks, which closes the whole class of holes the old server had: - Socket.IO had no auth at all: any client could emit addUser/joinRoom with another user's id and receive their messages. Realtime channels are now private and authorized against realtime.messages RLS. - Messages were broadcast by the sender's browser, so sender identity was spoofable. Rows are persisted first and fanned out by a database trigger; the insert policy pins sender_id to auth.uid(). - acceptFriendRequest never checked a request existed, so anyone could force-friend anyone. It is now an atomic function that verifies a pending row and raises otherwise. - Auth middleware called next() when the user lookup returned null. Replaced by Supabase Auth with httpOnly cookie sessions and getClaims() in the proxy, so the 30-day localStorage JWT is gone. - Presence replaces the in-process onlineUsers Map, which was wrong at more than one instance, and also carries typing state. - Messages are paginated and unread counts come from last_read_at, so a message no longer gets dropped when its chat isn't open. - Attachments moved from unbounded multer/Cloudinary to a private Storage bucket with a size limit and a MIME allowlist. Verified against the live project: a non-member reads zero rows from every table, cannot join a conversation channel, cannot mint a signed attachment URL, and cannot forge a message as another user.
- Sentry wired for client, server and edge via instrumentation files, with onRequestError so Server Component and Server Action failures are reported. Verified end to end: a thrown route handler produced PIXELCHAT-1 in Sentry. - supabase/tests/rls_test.sql asserts the isolation and integrity properties the old server got wrong: non-members read nothing, senders cannot be forged, stored messages cannot be edited or deleted, and a friend request cannot be accepted unless one is pending. Self-seeding and self-cleaning. - CI runs typecheck, lint and build on pushes and pull requests. - README documents the new stack and the access-control model, replacing the Render/Mongo/Cloudinary instructions which no longer apply.
Two problems the runtime check surfaced: - `?next=` was passed straight into redirect() after sign-in, so /login?next=https://evil.com sent the user off-site with a fresh session. safeRedirectPath() now accepts only same-origin absolute paths, rejecting scheme-relative forms like //evil.com and /\evil.com that browsers resolve to another host. - The login and signup pages rendered an empty shell: useSearchParams() in the form bailed the whole subtree out to client rendering. `next` now comes from the page's searchParams on the server and is passed down as a prop, so both pages server-render and the Suspense wrappers are gone. Covered by src/lib/validation.test.ts, run with node --test and wired into CI.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ZeroElemental
added a commit
that referenced
this pull request
Aug 27, 2026
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rebuilt the architecture and environment for