mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-01 11:55:51 -05:00
## Fixes - An application key with only `users` write could create a root admin or change an admin's password. Touching root admins now needs a key with write on everything. - An admin's account key could read node config (including the Wings token) and create deploy tokens. Those admin endpoints now need a panel session, and the application config endpoint no longer accepts account keys. `wings configure` with an application key still works. The email enumeration issue I originally had here is already covered by #7259, so I dropped it. Added tests for each. Full test suite, phpstan and pint pass. Checked the node config page and auto-deploy in the admin UI still work.
36 lines
870 B
PHP
36 lines
870 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pterodactyl\Http\Requests\Api\Application\Users;
|
|
|
|
use Pterodactyl\Actions\Users\CreateUser;
|
|
use Pterodactyl\Models\User;
|
|
|
|
class UpdateUserRequest extends StoreUserRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return parent::authorize() && (! $this->parameter('user', User::class)->root_admin || $this->canManageAdministrators());
|
|
}
|
|
|
|
/**
|
|
* Return the validation rules for this request.
|
|
*
|
|
* @param NormalizedValidationRules|null $rules
|
|
* @return ValidationRules
|
|
*/
|
|
public function rules(?array $rules = null): array
|
|
{
|
|
return parent::rules(CreateUser::rules($this->parameter('user', User::class)));
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
protected function extensionFieldsModel(): User
|
|
{
|
|
return $this->parameter('user', User::class);
|
|
}
|
|
}
|