You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Any user can rename and edit any other account through PUT /api/users/{own id} #584
PUT /api/users/{userId} is @CheckAuthorizedUserId. When userId is the caller's own id, MirthServlet.checkUserAuthorized(userId) lets the request through whatever the authorization controller says (so users can edit their own account). UserServlet.updateUser then saves the User from the request body, and that body's id is never compared with userId. So a user allowed to edit only themselves can put another account's id in the body and overwrite that account.
Without an authorization plugin everyone is allowed everything anyway, so this shows up once a plugin like RBAC restricts users. The authorization plugin can't block it either: checkUserAuthorized(userId) only throws when the controller says no and the URL id is not the caller's own.
Measured on 4.7.0, Derby, RBAC 1.3.0, as a user whose role is Viewer (no user management):
PUT /api/users/12 (another user's id in the URL), body = user 12 with a new username: 403, as expected.
PUT /api/users/6 (own id in the URL), same body naming user 12: 204. User 12 now has the new username and the caller's first and last name, because the body was built from the caller's own record.
UserServlet.updateUser is the same on main (dcd48b9). Fix: in updateUser, refuse a body whose id differs from userId (400), or set the body's id to userId before saving.
Activity