Repository navigation
fix(admin): gate user management page to President/Technology Coordinator - #66
Merged
Merged
Conversation
…ator The /admin/users page fetched all of admin.people with the service key and only required a login, so any member could view every member's name, email, and role. Require the viewer's role to be President or Technology Coordinator (same rule as the user-mutation APIs); everyone else is redirected to the dashboard.
|
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
/admin/usersfetched all ofadmin.peoplewith the service key (bypasses RLS) and its only protection was the layout's login check — any authenticated member could view every member's name, email, and role (audit finding: authenticated ≠ authorized).What
Before running the service-key query, resolve the viewer from their session and require
role ∈ {President, Technology Coordinator}— the same rule the user-mutation APIs already enforce. Unauthorized users are redirected to the dashboard; logged-out users to login.The viewer's own-role lookup works under the new
people_select_ownRLS policy (#64), which permits reading your own row.Verification
npm run buildpasses (41/41 pages).