[web-downloads] main: Improve type safety & security pass (strict_types, SensitiveParameter)

From: Date: Tue, 30 Sep 2025 11:07:09 +0000
Subject: [web-downloads] main: Improve type safety & security pass (strict_types, SensitiveParameter)
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-33240@lists.php.net to get a copy of this message
Author: Shivam Mathur (shivammathur) Date: 2025-09-30T16:31:33+05:30 Commit: https://github.com/php/web-downloads/commit/5f6098b0b43a6e55af205d4caa16cd375a24ac65 Raw diff: https://github.com/php/web-downloads/commit/5f6098b0b43a6e55af205d4caa16cd375a24ac65.diff Improve type safety & security pass (strict_types, SensitiveParameter) Changed paths: M autoloader.php M bootstrap.php M routes.php M runner.php M src/Actions/FetchArtifact.php M src/Actions/GetArtifacts.php M src/Actions/GetListing.php M src/Actions/UpdateReleasesJson.php M src/Auth.php M src/Console/Command.php M src/Console/Command/GenerateListingCommand.php M src/Console/Command/PeclCommand.php M src/Console/Command/PhpCommand.php M src/Console/Command/SeriesDeleteCommand.php M src/Console/Command/SeriesInitCommand.php M src/Console/Command/SeriesStabilityCommand.php M src/Console/Command/WinlibsCommand.php M src/Helpers/Helpers.php M src/Http/BaseController.php M src/Http/ControllerInterface.php M src/Http/Controllers/IndexController.php M src/Http/Controllers/PeclController.php M src/Http/Controllers/PhpController.php M src/Http/Controllers/SeriesDeleteController.php M src/Http/Controllers/SeriesInitController.php M src/Http/Controllers/SeriesStabilityController.php M src/Http/Controllers/WinlibsController.php M src/Router.php M src/Validator.php M tests/Actions/FetchArtifactTest.php M tests/Actions/GetArtifactsTest.php M tests/Actions/GetListingTest.php M tests/AuthTest.php M tests/BaseControllerTest.php M tests/CommandTest.php M tests/Console/Command/GenerateListingCommandTest.php M tests/Console/Command/PeclCommandTest.php M tests/Console/Command/PhpCommandTest.php M tests/Console/Command/SeriesDeleteCommandTest.php M tests/Console/Command/SeriesInitCommandTest.php M tests/Console/Command/SeriesStabilityCommandTest.php M tests/Console/Command/WinlibsCommandTest.php M tests/ControllerInterfaceTest.php M tests/Helpers/HelpersTest.php M tests/Http/Controllers/IndexControllerTest.php M tests/Http/Controllers/PeclControllerTest.php M tests/Http/Controllers/PhpControllerTest.php M tests/Http/Controllers/SeriesDeleteControllerTest.php M tests/Http/Controllers/SeriesInitControllerTest.php M tests/Http/Controllers/SeriesStabilityControllerTest.php M tests/Http/Controllers/WinlibsControllerTest.php M tests/RouterTest.php M tests/ValidatorTest.php Diff: diff --git a/autoloader.php b/autoloader.php index dcafefa..a30b4de 100644 --- a/autoloader.php +++ b/autoloader.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); spl_autoload_register(function ($class) { $prefix = 'App\\'; diff --git a/bootstrap.php b/bootstrap.php index 9307d53..f0a01a2 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); require_once __DIR__ . '/autoloader.php'; require_once __DIR__ . '/routes.php'; diff --git a/routes.php b/routes.php index fb590a3..bdf6001 100644 --- a/routes.php +++ b/routes.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); use App\Http\Controllers\IndexController; use App\Http\Controllers\PeclController; diff --git a/runner.php b/runner.php index 970cb9f..47324ea 100644 --- a/runner.php +++ b/runner.php @@ -1,5 +1,6 @@ #!/usr/bin/env php <?php +declare(strict_types=1); use App\Console\Command; diff --git a/src/Actions/FetchArtifact.php b/src/Actions/FetchArtifact.php index 784699e..c8f3203 100644 --- a/src/Actions/FetchArtifact.php +++ b/src/Actions/FetchArtifact.php @@ -1,10 +1,11 @@ <?php +declare(strict_types=1); namespace App\Actions; class FetchArtifact { - public function handle($url, $filepath, $token = null): void + public function handle($url, $filepath, #[\SensitiveParameter] $token = null): void { $ch = curl_init(); $fp = fopen($filepath, 'w'); diff --git a/src/Actions/GetArtifacts.php b/src/Actions/GetArtifacts.php index f1009b4..5167e00 100644 --- a/src/Actions/GetArtifacts.php +++ b/src/Actions/GetArtifacts.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Actions; @@ -6,7 +7,7 @@ class GetArtifacts { - public function handle($workflow_run_id, $token): void + public function handle($workflow_run_id, #[\SensitiveParameter] $token): void { $ch = curl_init(); diff --git a/src/Actions/GetListing.php b/src/Actions/GetListing.php index dfac097..014f6fd 100644 --- a/src/Actions/GetListing.php +++ b/src/Actions/GetListing.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Actions; diff --git a/src/Actions/UpdateReleasesJson.php b/src/Actions/UpdateReleasesJson.php index faad68e..109c312 100644 --- a/src/Actions/UpdateReleasesJson.php +++ b/src/Actions/UpdateReleasesJson.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Actions; diff --git a/src/Auth.php b/src/Auth.php index 1ade3e1..dd7b609 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App; diff --git a/src/Console/Command.php b/src/Console/Command.php index a59f9d1..92fed50 100644 --- a/src/Console/Command.php +++ b/src/Console/Command.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Console; diff --git a/src/Console/Command/GenerateListingCommand.php b/src/Console/Command/GenerateListingCommand.php index 2a82749..ccb2c24 100644 --- a/src/Console/Command/GenerateListingCommand.php +++ b/src/Console/Command/GenerateListingCommand.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Console\Command; diff --git a/src/Console/Command/PeclCommand.php b/src/Console/Command/PeclCommand.php index e02248f..2cac90f 100644 --- a/src/Console/Command/PeclCommand.php +++ b/src/Console/Command/PeclCommand.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Console\Command; diff --git a/src/Console/Command/PhpCommand.php b/src/Console/Command/PhpCommand.php index 2860e3b..ae1319f 100644 --- a/src/Console/Command/PhpCommand.php +++ b/src/Console/Command/PhpCommand.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Console\Command; diff --git a/src/Console/Command/SeriesDeleteCommand.php b/src/Console/Command/SeriesDeleteCommand.php index aa7691b..797407d 100644 --- a/src/Console/Command/SeriesDeleteCommand.php +++ b/src/Console/Command/SeriesDeleteCommand.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Console\Command; diff --git a/src/Console/Command/SeriesInitCommand.php b/src/Console/Command/SeriesInitCommand.php index d2db374..53c4dfd 100644 --- a/src/Console/Command/SeriesInitCommand.php +++ b/src/Console/Command/SeriesInitCommand.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Console\Command; diff --git a/src/Console/Command/SeriesStabilityCommand.php b/src/Console/Command/SeriesStabilityCommand.php index 82ae631..c8cfcfd 100644 --- a/src/Console/Command/SeriesStabilityCommand.php +++ b/src/Console/Command/SeriesStabilityCommand.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Console\Command; diff --git a/src/Console/Command/WinlibsCommand.php b/src/Console/Command/WinlibsCommand.php index c1b12b3..4ddac95 100644 --- a/src/Console/Command/WinlibsCommand.php +++ b/src/Console/Command/WinlibsCommand.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Console\Command; diff --git a/src/Helpers/Helpers.php b/src/Helpers/Helpers.php index 7a7556b..670570b 100644 --- a/src/Helpers/Helpers.php +++ b/src/Helpers/Helpers.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Helpers; diff --git a/src/Http/BaseController.php b/src/Http/BaseController.php index b8cd681..036e114 100644 --- a/src/Http/BaseController.php +++ b/src/Http/BaseController.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Http; diff --git a/src/Http/ControllerInterface.php b/src/Http/ControllerInterface.php index bb7a226..70096aa 100644 --- a/src/Http/ControllerInterface.php +++ b/src/Http/ControllerInterface.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Http; diff --git a/src/Http/Controllers/IndexController.php b/src/Http/Controllers/IndexController.php index 4296a95..298c2a1 100644 --- a/src/Http/Controllers/IndexController.php +++ b/src/Http/Controllers/IndexController.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Http\Controllers; diff --git a/src/Http/Controllers/PeclController.php b/src/Http/Controllers/PeclController.php index 4552229..4adbff0 100644 --- a/src/Http/Controllers/PeclController.php +++ b/src/Http/Controllers/PeclController.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Http\Controllers; @@ -47,7 +48,7 @@ public function execute(array $data): void /** * @throws Exception */ - protected function fetchExtension(string $extension, string $ref, string $url, string $token): void + protected function fetchExtension(string $extension, string $ref, string $url, #[\SensitiveParameter] string $token): void { $directory = getenv('BUILDS_DIRECTORY') . "/pecl"; $filepath = $directory . "/$extension-$ref-" . hash('sha256', $url) . time() . ".zip"; diff --git a/src/Http/Controllers/PhpController.php b/src/Http/Controllers/PhpController.php index f354f80..56da407 100644 --- a/src/Http/Controllers/PhpController.php +++ b/src/Http/Controllers/PhpController.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Http\Controllers; @@ -41,7 +42,7 @@ protected function execute(array $data): void /** * @throws Exception */ - private function fetchPhpBuild(string $url, string $token): void + private function fetchPhpBuild(string $url, #[\SensitiveParameter] string $token): void { $hash = hash('sha256', $url) . time(); diff --git a/src/Http/Controllers/SeriesDeleteController.php b/src/Http/Controllers/SeriesDeleteController.php index d43d1bf..0dbad82 100644 --- a/src/Http/Controllers/SeriesDeleteController.php +++ b/src/Http/Controllers/SeriesDeleteController.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Http\Controllers; diff --git a/src/Http/Controllers/SeriesInitController.php b/src/Http/Controllers/SeriesInitController.php index 7cf213e..2e78f57 100644 --- a/src/Http/Controllers/SeriesInitController.php +++ b/src/Http/Controllers/SeriesInitController.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Http\Controllers; diff --git a/src/Http/Controllers/SeriesStabilityController.php b/src/Http/Controllers/SeriesStabilityController.php index cdaa1b6..9acff0d 100644 --- a/src/Http/Controllers/SeriesStabilityController.php +++ b/src/Http/Controllers/SeriesStabilityController.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Http\Controllers; diff --git a/src/Http/Controllers/WinlibsController.php b/src/Http/Controllers/WinlibsController.php index 77f3374..a997f5a 100644 --- a/src/Http/Controllers/WinlibsController.php +++ b/src/Http/Controllers/WinlibsController.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App\Http\Controllers; diff --git a/src/Router.php b/src/Router.php index 59c5861..929a477 100644 --- a/src/Router.php +++ b/src/Router.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App; diff --git a/src/Validator.php b/src/Validator.php index 119b23a..298cbd8 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace App; diff --git a/tests/Actions/FetchArtifactTest.php b/tests/Actions/FetchArtifactTest.php index 27a956e..2ee2d5a 100644 --- a/tests/Actions/FetchArtifactTest.php +++ b/tests/Actions/FetchArtifactTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Actions; diff --git a/tests/Actions/GetArtifactsTest.php b/tests/Actions/GetArtifactsTest.php index 72e279c..bdc8a90 100644 --- a/tests/Actions/GetArtifactsTest.php +++ b/tests/Actions/GetArtifactsTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Actions; diff --git a/tests/Actions/GetListingTest.php b/tests/Actions/GetListingTest.php index ed929e1..01c83fa 100644 --- a/tests/Actions/GetListingTest.php +++ b/tests/Actions/GetListingTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Actions; diff --git a/tests/AuthTest.php b/tests/AuthTest.php index 4a8b497..b666da7 100644 --- a/tests/AuthTest.php +++ b/tests/AuthTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); use App\Auth; use PHPUnit\Framework\TestCase; diff --git a/tests/BaseControllerTest.php b/tests/BaseControllerTest.php index c3e8099..8e59bf0 100644 --- a/tests/BaseControllerTest.php +++ b/tests/BaseControllerTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); use PHPUnit\Framework\TestCase; use App\Http\BaseController; diff --git a/tests/CommandTest.php b/tests/CommandTest.php index ea3a03d..8778c51 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); use PHPUnit\Framework\TestCase; use App\Console\Command; diff --git a/tests/Console/Command/GenerateListingCommandTest.php b/tests/Console/Command/GenerateListingCommandTest.php index ec53b67..c09e595 100644 --- a/tests/Console/Command/GenerateListingCommandTest.php +++ b/tests/Console/Command/GenerateListingCommandTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Console\Command; diff --git a/tests/Console/Command/PeclCommandTest.php b/tests/Console/Command/PeclCommandTest.php index 0166c55..9ac7013 100644 --- a/tests/Console/Command/PeclCommandTest.php +++ b/tests/Console/Command/PeclCommandTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Console\Command; diff --git a/tests/Console/Command/PhpCommandTest.php b/tests/Console/Command/PhpCommandTest.php index 5178423..a3d22ed 100644 --- a/tests/Console/Command/PhpCommandTest.php +++ b/tests/Console/Command/PhpCommandTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Console\Command; diff --git a/tests/Console/Command/SeriesDeleteCommandTest.php b/tests/Console/Command/SeriesDeleteCommandTest.php index fbca7f2..9929b8b 100644 --- a/tests/Console/Command/SeriesDeleteCommandTest.php +++ b/tests/Console/Command/SeriesDeleteCommandTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Console\Command; diff --git a/tests/Console/Command/SeriesInitCommandTest.php b/tests/Console/Command/SeriesInitCommandTest.php index feee61b..ba16752 100644 --- a/tests/Console/Command/SeriesInitCommandTest.php +++ b/tests/Console/Command/SeriesInitCommandTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Console\Command; diff --git a/tests/Console/Command/SeriesStabilityCommandTest.php b/tests/Console/Command/SeriesStabilityCommandTest.php index cf186a6..b3364a0 100644 --- a/tests/Console/Command/SeriesStabilityCommandTest.php +++ b/tests/Console/Command/SeriesStabilityCommandTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Console\Command; diff --git a/tests/Console/Command/WinlibsCommandTest.php b/tests/Console/Command/WinlibsCommandTest.php index 31154b4..720e0db 100644 --- a/tests/Console/Command/WinlibsCommandTest.php +++ b/tests/Console/Command/WinlibsCommandTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Console\Command; diff --git a/tests/ControllerInterfaceTest.php b/tests/ControllerInterfaceTest.php index cb97400..338a021 100644 --- a/tests/ControllerInterfaceTest.php +++ b/tests/ControllerInterfaceTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); use PHPUnit\Framework\TestCase; class ControllerInterfaceTest extends TestCase { diff --git a/tests/Helpers/HelpersTest.php b/tests/Helpers/HelpersTest.php index a89d18a..24ef410 100644 --- a/tests/Helpers/HelpersTest.php +++ b/tests/Helpers/HelpersTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Helpers; diff --git a/tests/Http/Controllers/IndexControllerTest.php b/tests/Http/Controllers/IndexControllerTest.php index 7f1bca7..71547a6 100644 --- a/tests/Http/Controllers/IndexControllerTest.php +++ b/tests/Http/Controllers/IndexControllerTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Http\Controllers; diff --git a/tests/Http/Controllers/PeclControllerTest.php b/tests/Http/Controllers/PeclControllerTest.php index ffae927..ccf5961 100644 --- a/tests/Http/Controllers/PeclControllerTest.php +++ b/tests/Http/Controllers/PeclControllerTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Http\Controllers; diff --git a/tests/Http/Controllers/PhpControllerTest.php b/tests/Http/Controllers/PhpControllerTest.php index d677f7f..ea7b1f3 100644 --- a/tests/Http/Controllers/PhpControllerTest.php +++ b/tests/Http/Controllers/PhpControllerTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Http\Controllers; diff --git a/tests/Http/Controllers/SeriesDeleteControllerTest.php b/tests/Http/Controllers/SeriesDeleteControllerTest.php index 23fe8cb..15c65eb 100644 --- a/tests/Http/Controllers/SeriesDeleteControllerTest.php +++ b/tests/Http/Controllers/SeriesDeleteControllerTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Http\Controllers; diff --git a/tests/Http/Controllers/SeriesInitControllerTest.php b/tests/Http/Controllers/SeriesInitControllerTest.php index 1aa7db3..a619676 100644 --- a/tests/Http/Controllers/SeriesInitControllerTest.php +++ b/tests/Http/Controllers/SeriesInitControllerTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Http\Controllers; diff --git a/tests/Http/Controllers/SeriesStabilityControllerTest.php b/tests/Http/Controllers/SeriesStabilityControllerTest.php index 45e69ca..e9005b8 100644 --- a/tests/Http/Controllers/SeriesStabilityControllerTest.php +++ b/tests/Http/Controllers/SeriesStabilityControllerTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Http\Controllers; diff --git a/tests/Http/Controllers/WinlibsControllerTest.php b/tests/Http/Controllers/WinlibsControllerTest.php index f4ed100..5d6522d 100644 --- a/tests/Http/Controllers/WinlibsControllerTest.php +++ b/tests/Http/Controllers/WinlibsControllerTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace Http\Controllers; diff --git a/tests/RouterTest.php b/tests/RouterTest.php index de3a176..1668f92 100644 --- a/tests/RouterTest.php +++ b/tests/RouterTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); use PHPUnit\Framework\TestCase; use App\Router; diff --git a/tests/ValidatorTest.php b/tests/ValidatorTest.php index c355ffb..754fe5c 100644 --- a/tests/ValidatorTest.php +++ b/tests/ValidatorTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); use App\Validator; use PHPUnit\Framework\TestCase;

« previous php.webmaster (#33240) next »