Skip to content

Commit 240f3e4

Browse files
authored
Ensure users cannot modify their roles on main
Ensure users cannot modify their roles
2 parents 1291b3d + 97a03e7 commit 240f3e4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

backend/onyx/auth/schemas.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,7 @@ class UserCreate(schemas.BaseUserCreate):
4949

5050

5151
class UserUpdate(schemas.BaseUserUpdate):
52-
role: UserRole
52+
"""
53+
Role updates are not allowed through the user update endpoint for security reasons
54+
Role changes should be handled through a separate, admin-only process
55+
"""

backend/onyx/auth/users.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ async def create(
272272
if not user.role.is_web_login() and user_create.role.is_web_login():
273273
user_update = UserUpdate(
274274
password=user_create.password,
275-
role=user_create.role,
276275
is_verified=user_create.is_verified,
277276
)
278277
user = await self.update(user_update, user)

0 commit comments

Comments
 (0)