Repository navigation
fix(api): allowlist profile fields in firsttimesetup and settings - #65
Merged
Merged
Conversation
firsttimesetup spread the raw client body into a service-role update of admin.people, letting any authenticated user set arbitrary columns — including role — on their own row. Copy only profile fields instead. Settings likewise submitted the full profile object; trim it to the editable columns so it also keeps working under the new column-level UPDATE grant.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully 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.
Why
api/auth/firsttimesetupspread the raw client JSON into a service-role update ofadmin.peoplewith no field allowlist — any authenticated user could POST{"data":{"role":"President"}}and promote themselves (service key bypasses RLS, so the DB migration in #64 alone can't stop this path).Settings.tsxsimilarly submitted the entire profile object (incl.role,email,publish).What
firsttimesetup/route.ts: copy onlyfirst_name,last_name,displayName,pictureURLfrom the request body.Settings.tsx: submit onlyfirst_name,last_name,pictureURL— also required for the save to keep working once fix(db): least-privilege RLS and grants for admin.people #64's column-level UPDATE grant is applied.Verification
npm run buildpasses.