diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bb4abb039..c6ada7b77 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,8 +12,8 @@ jobs: strategy: fail-fast: false matrix: - php: [ 7.4, 8.0 ] - database: [ 'mariadb:10.2', 'mysql:8' ] + php: [ 7.4, 8.0, 8.1 ] + database: [ 'mariadb:10.6', 'mysql:8' ] services: database: image: ${{ matrix.database }} @@ -51,21 +51,14 @@ jobs: run: composer install --prefer-dist --no-interaction --no-progress - name: Run cs-fixer run: vendor/bin/php-cs-fixer fix --dry-run --diff --format=txt --config .php-cs-fixer.dist.php - continue-on-error: true - name: Static Analysis if: ${{ matrix.php }} == '8.0' run: | php artisan ide-helper:models -N ./vendor/bin/phpstan analyse --memory-limit=2G env: - TESTING_DB_PORT: ${{ job.services.database.ports[3306] }} - - name: Execute Unit Tests - run: php artisan test tests/Unit - if: ${{ always() }} - env: - DB_PORT: ${{ job.services.database.ports[3306] }} - - name: Execute Integration Tests - run: php artisan test tests/Integration - if: ${{ always() }} + DB_PORT: ${{ job.services.database.ports[3306] }} + - name: Execute Tests + run: php artisan test env: DB_PORT: ${{ job.services.database.ports[3306] }} diff --git a/app/Console/Commands/Environment/AppSettingsCommand.php b/app/Console/Commands/Environment/AppSettingsCommand.php index ecb1ac3df..3bf918977 100644 --- a/app/Console/Commands/Environment/AppSettingsCommand.php +++ b/app/Console/Commands/Environment/AppSettingsCommand.php @@ -119,6 +119,7 @@ class AppSettingsCommand extends Command foreach ($validator->errors()->all() as $error) { $this->output->error($error); } + return 1; } diff --git a/app/Http/Controllers/Api/Application/Eggs/EggController.php b/app/Http/Controllers/Api/Application/Eggs/EggController.php index 4f1b9700c..622b175e1 100644 --- a/app/Http/Controllers/Api/Application/Eggs/EggController.php +++ b/app/Http/Controllers/Api/Application/Eggs/EggController.php @@ -15,8 +15,8 @@ use Pterodactyl\Exceptions\Http\QueryValueOutOfRangeHttpException; use Pterodactyl\Http\Requests\Api\Application\Eggs\GetEggsRequest; use Pterodactyl\Http\Requests\Api\Application\Eggs\StoreEggRequest; use Pterodactyl\Http\Requests\Api\Application\Eggs\DeleteEggRequest; -use Pterodactyl\Http\Requests\Api\Application\Eggs\UpdateEggRequest; use Pterodactyl\Http\Requests\Api\Application\Eggs\ExportEggRequest; +use Pterodactyl\Http\Requests\Api\Application\Eggs\UpdateEggRequest; use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController; class EggController extends ApplicationApiController diff --git a/app/Http/Controllers/Api/Client/SecurityKeyController.php b/app/Http/Controllers/Api/Client/SecurityKeyController.php index 132e0b862..1431f33c4 100644 --- a/app/Http/Controllers/Api/Client/SecurityKeyController.php +++ b/app/Http/Controllers/Api/Client/SecurityKeyController.php @@ -7,12 +7,9 @@ use Illuminate\Support\Str; use Illuminate\Http\Request; use Illuminate\Http\JsonResponse; use Pterodactyl\Models\SecurityKey; -use Nyholm\Psr7\Factory\Psr17Factory; use Illuminate\Contracts\Cache\Repository; -use Psr\Http\Message\ServerRequestInterface; use Pterodactyl\Exceptions\DisplayException; use Webauthn\PublicKeyCredentialCreationOptions; -use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory; use Pterodactyl\Transformers\Api\Client\SecurityKeyTransformer; use Pterodactyl\Repositories\SecurityKeys\WebauthnServerRepository; use Pterodactyl\Services\Users\SecurityKeys\StoreSecurityKeyService; diff --git a/app/Http/Controllers/Auth/LoginCheckpointController.php b/app/Http/Controllers/Auth/LoginCheckpointController.php index c7b98de73..90f397b92 100644 --- a/app/Http/Controllers/Auth/LoginCheckpointController.php +++ b/app/Http/Controllers/Auth/LoginCheckpointController.php @@ -4,10 +4,10 @@ namespace Pterodactyl\Http\Controllers\Auth; use Carbon\CarbonImmutable; use Carbon\CarbonInterface; -use Pterodactyl\Models\User; use Illuminate\Http\Request; -use PragmaRX\Google2FA\Google2FA; +use Pterodactyl\Models\User; use Illuminate\Http\JsonResponse; +use PragmaRX\Google2FA\Google2FA; use Pterodactyl\Models\SecurityKey; use Illuminate\Contracts\Encryption\Encrypter; use Webauthn\PublicKeyCredentialRequestOptions; diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 446623916..b4aa03ea8 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -19,9 +19,6 @@ class LoginController extends AbstractLoginController protected GeneratePublicKeyCredentialsRequestService $service; - /** - * @param \Pterodactyl\Services\Users\SecurityKeys\GeneratePublicKeyCredentialsRequestService $service - */ public function __construct(GeneratePublicKeyCredentialsRequestService $service) { parent::__construct(); diff --git a/app/Models/SecurityKey.php b/app/Models/SecurityKey.php index 76fcbe812..9dc89543d 100644 --- a/app/Models/SecurityKey.php +++ b/app/Models/SecurityKey.php @@ -113,9 +113,6 @@ class SecurityKey extends Model /** * Returns a PSR17 Request factory to be used by different Webauthn tooling. - * - * @param \Illuminate\Http\Request $request - * @return \Psr\Http\Message\ServerRequestInterface */ public static function getPsrRequestFactory(Request $request): ServerRequestInterface { diff --git a/app/Models/User.php b/app/Models/User.php index 2819273e4..1b62ca428 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -231,9 +231,6 @@ class User extends Model implements ->groupBy('servers.id'); } - /** - * @return \Webauthn\PublicKeyCredentialUserEntity - */ public function toPublicKeyCredentialEntity(): PublicKeyCredentialUserEntity { return new PublicKeyCredentialUserEntity($this->username, $this->uuid, $this->email, null); diff --git a/app/Repositories/SecurityKeys/PublicKeyCredentialSourceRepository.php b/app/Repositories/SecurityKeys/PublicKeyCredentialSourceRepository.php index d8dc92d18..4ea33bfd8 100644 --- a/app/Repositories/SecurityKeys/PublicKeyCredentialSourceRepository.php +++ b/app/Repositories/SecurityKeys/PublicKeyCredentialSourceRepository.php @@ -2,12 +2,11 @@ namespace Pterodactyl\Repositories\SecurityKeys; -use Ramsey\Uuid\Uuid; use Pterodactyl\Models\User; use Illuminate\Container\Container; +use Pterodactyl\Models\SecurityKey; use Webauthn\PublicKeyCredentialSource; use Webauthn\PublicKeyCredentialUserEntity; -use Pterodactyl\Models\SecurityKey; use Webauthn\PublicKeyCredentialSourceRepository as PublicKeyRepositoryInterface; class PublicKeyCredentialSourceRepository implements PublicKeyRepositoryInterface diff --git a/app/Services/Servers/ServerCreationService.php b/app/Services/Servers/ServerCreationService.php index ad67d7144..226d960d0 100644 --- a/app/Services/Servers/ServerCreationService.php +++ b/app/Services/Servers/ServerCreationService.php @@ -25,7 +25,7 @@ class ServerCreationService * @var \Pterodactyl\Services\Deployment\AllocationSelectionService */ private $allocationSelectionService; - + /** * @var \Illuminate\Database\ConnectionInterface */ diff --git a/app/Services/Servers/SuspensionService.php b/app/Services/Servers/SuspensionService.php index 60bae5415..8b9228f66 100644 --- a/app/Services/Servers/SuspensionService.php +++ b/app/Services/Servers/SuspensionService.php @@ -11,7 +11,7 @@ class SuspensionService { public const ACTION_SUSPEND = 'suspend'; public const ACTION_UNSUSPEND = 'unsuspend'; - + /** * @var \Pterodactyl\Repositories\Wings\DaemonServerRepository */ @@ -20,7 +20,8 @@ class SuspensionService /** * SuspensionService constructor. */ - public function __construct(DaemonServerRepository $daemonServerRepository) { + public function __construct(DaemonServerRepository $daemonServerRepository) + { $this->daemonServerRepository = $daemonServerRepository; } diff --git a/app/Services/Users/SecurityKeys/GeneratePublicKeyCredentialsRequestService.php b/app/Services/Users/SecurityKeys/GeneratePublicKeyCredentialsRequestService.php index 234e00162..8ab519924 100644 --- a/app/Services/Users/SecurityKeys/GeneratePublicKeyCredentialsRequestService.php +++ b/app/Services/Users/SecurityKeys/GeneratePublicKeyCredentialsRequestService.php @@ -11,18 +11,11 @@ class GeneratePublicKeyCredentialsRequestService { protected WebauthnServerRepository $serverRepository; - /** - * @param \Pterodactyl\Repositories\SecurityKeys\WebauthnServerRepository $serverRepository - */ public function __construct(WebauthnServerRepository $serverRepository) { $this->serverRepository = $serverRepository; } - /** - * @param \Pterodactyl\Models\User $user - * @return \Webauthn\PublicKeyCredentialRequestOptions - */ public function handle(User $user): PublicKeyCredentialRequestOptions { $credentials = $user->securityKeys->map(function (SecurityKey $key) { @@ -31,7 +24,8 @@ class GeneratePublicKeyCredentialsRequestService $response = $this->serverRepository->getServer($user) ->generatePublicKeyCredentialRequestOptions( - PublicKeyCredentialRequestOptions::USER_VERIFICATION_REQUIREMENT_PREFERRED, $credentials + PublicKeyCredentialRequestOptions::USER_VERIFICATION_REQUIREMENT_PREFERRED, + $credentials ); return $response->setTimeout(300); diff --git a/database/Factories/SecurityKeyFactory.php b/database/Factories/SecurityKeyFactory.php index 730466c9c..962faeab5 100644 --- a/database/Factories/SecurityKeyFactory.php +++ b/database/Factories/SecurityKeyFactory.php @@ -26,7 +26,6 @@ class SecurityKeyFactory extends Factory } /** - * @param \Pterodactyl\Models\User $user * @return $this */ public function withUser(User $user): self diff --git a/database/migrations/2021_08_07_170141_create_security_keys_table.php b/database/migrations/2021_08_07_170141_create_security_keys_table.php index 2636848e2..be620d428 100644 --- a/database/migrations/2021_08_07_170141_create_security_keys_table.php +++ b/database/migrations/2021_08_07_170141_create_security_keys_table.php @@ -1,8 +1,8 @@ patchJson('/api/application/locations/' . $location->id, [ 'short' => 'new inhouse', - 'long' => 'This is my new inhouse location' + 'long' => 'This is my new inhouse location', ]); $response->assertStatus(Response::HTTP_OK); $response->assertJsonCount(2); $response->assertJsonStructure([ 'object', - 'attributes' => ['id', 'short', 'long', 'created_at', 'updated_at'] + 'attributes' => ['id', 'short', 'long', 'created_at', 'updated_at'], ]); $this->assertDatabaseHas('locations', ['short' => 'new inhouse', 'long' => 'This is my new inhouse location']);