Skip to content

fix: prevent member self-promotion to admin - #42

Merged
U-Naveen merged 1 commit into
mainfrom
sec_issues2
Sep 8, 2026
Merged

U-Naveen merged 1 commit into
mainfrom
sec_issues2

Conversation

@U-Naveen

@U-Naveen U-Naveen commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Security Fix — Member Self-Promotion to Admin

Fixed a critical privilege-escalation vulnerability where authenticated members could directly modify their role field and promote themselves to administrator.

Changes

  • Revoked direct update access to privileged users columns for normal clients.
  • Prevented direct modification of the role field through the Supabase API.
  • Added a secure admin_update_user_role() PostgreSQL RPC for role management.
  • Added server-side is_admin() authorization checks to the role-management RPC.
  • Restricted roles to member and admin.
  • Prevented administrators from accidentally removing their own admin privileges.
  • Updated MembersAdmin.tsx to use the secure RPC instead of directly updating the users table.
  • Added audit logging for administrator role changes.
  • Preserved normal profile-editing functionality while protecting privileged fields.

Security Flow

Normal Member
→ Direct role update
→ Database denied

Administrator
→ admin_update_user_role()
→ is_admin() validation
→ Role updated
→ Audit log recorded

This closes the member → admin privilege-escalation path identified during the security audit.

@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
init-website Ready Ready Preview Sep 8, 2026 3:28pm UTC

@U-Naveen
U-Naveen merged commit eecdd31 into main Sep 8, 2026
5 checks passed

This branch was successfully deployed

2 active deployments
Preview – init-website-leaderboard-testing — 2498362e Deployed Sep 8, 2026 by vercel[bot]
Preview – init-website — 2498362e Deployed Sep 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant