mirror of
https://github.com/projectsend/projectsend.git
synced 2026-10-11 23:42:35 +00:00
Keep your own credentials behind your profile, and end tokens on a reset
Your own email address, password and second factor are changed from your profile, which asks for your current password. The staff screen and the API changed the first two with no password at all, and the API removed the third on your own account without the confirmation the web asks for. StaffAccounts::ownCredentialChanges is the one rule both now ask: the staff screen refuses your own email or password with a validation error and points to the profile, and the API answers 403, as it does for removing your own second factor. Changing somebody else's password is unchanged: that is what edit_users and edit_clients mean, on the screen and over the API. It now also revokes that account's API tokens. Browser sessions already ended with the password hash; tokens did not. GHSA-j5cp-r8pr-m5cr
This commit is contained in:
@@ -182,6 +182,15 @@ class UsersController extends Controller
|
||||
'assigned_clients.*' => ['integer', Rule::in($this->accounts->assignableClientIds($actor))],
|
||||
]);
|
||||
|
||||
// Your own email address and password are changed from your
|
||||
// profile, which asks for your current password. A token cannot be
|
||||
// asked for one, so here the answer is no.
|
||||
abort_if(
|
||||
$this->accounts->ownCredentialChanges($actor, $user, $validated['email'] ?? null, $validated['password'] ?? null) !== [],
|
||||
403,
|
||||
__('Change your own email address and password from your profile.'),
|
||||
);
|
||||
|
||||
// Read through Request::boolean() rather than off the validated
|
||||
// array, for the reason RolesController::guardScopeRemoval spells
|
||||
// out: the `boolean` rule accepts 0 and "0" as well as false but
|
||||
@@ -274,7 +283,14 @@ class UsersController extends Controller
|
||||
{
|
||||
abort_unless($user->isStaff(), 404);
|
||||
|
||||
$this->accounts->guardTarget($this->actor($request), $user);
|
||||
$actor = $this->actor($request);
|
||||
$this->accounts->guardTarget($actor, $user);
|
||||
|
||||
// The web asks for your password before this (password.confirm),
|
||||
// and a token cannot give one. On your own account it would let a
|
||||
// token clear the second factor standing between it and a browser
|
||||
// session as you.
|
||||
abort_if($user->is($actor), 403, __('Remove your own two-factor authentication from your profile.'));
|
||||
|
||||
$twoFactor->reset($user);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user