From f4bb0da242637bb78ddfef2da3afec237e2aa917 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 18 Apr 2026 05:32:54 +0200 Subject: [PATCH] Fix mago issues. --- .../Commands/Correction/RestoresOAuthKeys.php | 4 ++-- app/Http/Controllers/Profile/OAuthController.php | 12 ++++++------ app/Http/Controllers/ProfileController.php | 4 ++-- app/Support/System/OAuthKeys.php | 4 ++-- .../2026_04_13_185808_migrations_04_2026.php | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/Console/Commands/Correction/RestoresOAuthKeys.php b/app/Console/Commands/Correction/RestoresOAuthKeys.php index 53690a6ee1..2fb529954d 100644 --- a/app/Console/Commands/Correction/RestoresOAuthKeys.php +++ b/app/Console/Commands/Correction/RestoresOAuthKeys.php @@ -47,8 +47,8 @@ class RestoresOAuthKeys extends Command $this->restoreOAuthKeys(); if (! windows_os()) { - chmod(Passport::keyPath('oauth-public.key'), 0660); - chmod(Passport::keyPath('oauth-private.key'), 0600); + chmod(Passport::keyPath('oauth-public.key'), 0o660); + chmod(Passport::keyPath('oauth-private.key'), 0o600); } Log::debug('Done with OAuth Keys command.'); diff --git a/app/Http/Controllers/Profile/OAuthController.php b/app/Http/Controllers/Profile/OAuthController.php index 51ad524588..9524e0b4a2 100644 --- a/app/Http/Controllers/Profile/OAuthController.php +++ b/app/Http/Controllers/Profile/OAuthController.php @@ -36,7 +36,7 @@ use Laravel\Passport\Client; use Laravel\Passport\ClientRepository; use Laravel\Passport\Token; -class OAuthController extends Controller +final class OAuthController extends Controller { protected bool $internalAuth; @@ -83,7 +83,7 @@ class OAuthController extends Controller public function storeClient(Request $request): JsonResponse { - $this->validation->make($request->all(), [ + $this->validation->make($request->only(['name','redirect_uris','confidential']), [ 'name' => ['required', 'string', 'max:255'], 'redirect_uris' => ['required', 'url'], 'confidential' => 'boolean', @@ -125,7 +125,7 @@ class OAuthController extends Controller return new Response('', 404); } - $this->validation->make($request->all(), [ + $this->validation->make($request->only(['name','redirect_uris']), [ 'name' => ['required', 'string', 'max:255'], 'redirect_uris' => ['required', 'url'], ])->validate(); @@ -146,7 +146,7 @@ class OAuthController extends Controller return new Response('', 404); } - $client->tokens()->with('refreshToken')->each(function (Token $token): void { + $client->tokens()->with('refreshToken')->each(function (#[\SensitiveParameter] Token $token): void { $token->refreshToken?->revoke(); $token->revoke(); }); @@ -158,7 +158,7 @@ class OAuthController extends Controller public function storePersonalAccessToken(Request $request): JsonResponse { - $this->validation->make($request->all(), [ + $this->validation->make($request->only(['name']), [ 'name' => ['required', 'max:255']])->validate(); return response()->json($request->user()->createToken($request->name)); @@ -185,7 +185,7 @@ class OAuthController extends Controller ->where('revoked', false) ->where('expires_at', '>', Date::now()) ->get() - ->filter(fn(Token $token) => $token->client->hasGrantType('personal_access')); + ->filter(fn(#[\SensitiveParameter] Token $token) => $token->client->hasGrantType('personal_access')); return response()->json($tokens); } diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index d8cd15abce..357d45c6ee 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -45,11 +45,11 @@ use Illuminate\Http\Request; use Illuminate\Routing\Redirector; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\DB; + use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Log; use Illuminate\View\View; -use Laravel\Passport\ClientRepository; + use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use SensitiveParameter; diff --git a/app/Support/System/OAuthKeys.php b/app/Support/System/OAuthKeys.php index 741a2f807e..a029e7c9fc 100644 --- a/app/Support/System/OAuthKeys.php +++ b/app/Support/System/OAuthKeys.php @@ -150,8 +150,8 @@ class OAuthKeys if (! windows_os()) { Log::debug('Set the correct permissions.'); - chmod(Passport::keyPath('oauth-public.key'), 0660); - chmod(Passport::keyPath('oauth-private.key'), 0600); + chmod(Passport::keyPath('oauth-public.key'), 0o660); + chmod(Passport::keyPath('oauth-private.key'), 0o600); } Log::debug(sprintf('Will store private key with hash "%s" in file "%s"', hash('sha256', $privateContent), $private)); diff --git a/database/migrations/2026_04_13_185808_migrations_04_2026.php b/database/migrations/2026_04_13_185808_migrations_04_2026.php index cd5cc16461..12f5f92e71 100644 --- a/database/migrations/2026_04_13_185808_migrations_04_2026.php +++ b/database/migrations/2026_04_13_185808_migrations_04_2026.php @@ -2,11 +2,11 @@ declare(strict_types=1); -use Illuminate\Database\Eloquent\Model; + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -use Laravel\Passport\Passport; + return new class extends Migration { @@ -85,6 +85,6 @@ return new class extends Migration */ public function down(): void { - // + } };