Skip to content

fix(users): prevent non-admins from updating admin users - #1132

Open
raulriera wants to merge 1 commit into
masterfrom
fix/users-update-admin-guard
Open

fix(users): prevent non-admins from updating admin users#1132
raulriera wants to merge 1 commit into
masterfrom
fix/users-update-admin-guard

Conversation

@raulriera

Copy link
Copy Markdown
Member

Summary

  • The admin-protection check in users#update registered a render inside respond_to but never returned, so execution fell through and a non-admin's changes to an admin user were persisted (update is excluded from require_practice_admin so users can edit their own profile)
  • Replaced with an early-return guard that redirects to /401 before the update runs
  • Also removes the invalid error: render option the old branch carried

Test plan

  • Red test proves a non-admin's edit to an admin was persisted
  • Green after fix
  • Full suite passes (523 runs, 0 failures)

The admin-protection check inside respond_to registered a render but
never returned, so execution fell through to @user.update and the
non-admin's changes were persisted (update is excluded from
require_practice_admin so users can edit themselves). Replace with an
early-return guard redirecting to /401.
@github-actions github-actions Bot added the fix A bug has been resolved label Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A bug has been resolved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant