Skip to content

Commit

Permalink
Ensure users cannot modify their roles on main
Browse files Browse the repository at this point in the history
Ensure users cannot modify their roles
  • Loading branch information
pablonyx authored Dec 31, 2024
2 parents 1291b3d + 97a03e7 commit 240f3e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion backend/onyx/auth/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@ class UserCreate(schemas.BaseUserCreate):


class UserUpdate(schemas.BaseUserUpdate):
role: UserRole
"""
Role updates are not allowed through the user update endpoint for security reasons
Role changes should be handled through a separate, admin-only process
"""
1 change: 0 additions & 1 deletion backend/onyx/auth/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ async def create(
if not user.role.is_web_login() and user_create.role.is_web_login():
user_update = UserUpdate(
password=user_create.password,
role=user_create.role,
is_verified=user_create.is_verified,
)
user = await self.update(user_update, user)
Expand Down

0 comments on commit 240f3e4

Please sign in to comment.