An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix(webhook): match repositories under self-hosted sub-paths
Andras Bacsai3b922483092c
diff --git a/app/Http/Controllers/Webhook/Concerns/MatchesManualWebhookApplications.php b/app/Http/Controllers/Webhook/Concerns/MatchesManualWebhookApplications.phpindex 7f2feb1e04..decb6705fc 100644--- a/app/Http/Controllers/Webhook/Concerns/MatchesManualWebhookApplications.php+++ b/app/Http/Controllers/Webhook/Concerns/MatchesManualWebhookApplications.php@@ -50,7 +50,13 @@ trait MatchesManualWebhookApplications// Git hosts (GitHub, GitLab, Gitea, Bitbucket) treat owner/repo names// case-insensitively, so compare the canonical paths case-insensitively.- return hash_equals(mb_strtolower($fullName), mb_strtolower($repositoryPath));+ $fullName = mb_strtolower($fullName);+ $repositoryPath = mb_strtolower($repositoryPath);++ // A self-hosted Git host can serve repositories under a sub-path+ // (https://example.com/gitea/owner/repo), which is not part of the+ // repository name in the webhook payload.+ return $repositoryPath === $fullName || str_ends_with($repositoryPath, '/'.$fullName);}/**diff --git a/tests/Feature/Webhook/WebhookHmacTest.php b/tests/Feature/Webhook/WebhookHmacTest.phpindex 2a24b177cc..7a6a3e533e 100644--- a/tests/Feature/Webhook/WebhookHmacTest.php+++ b/tests/Feature/Webhook/WebhookHmacTest.php@@ -932,18 +932,23 @@ describe('Manual Webhook Repository Matching', function () {'scp-style with custom user and port' => '[email protected]:2222/test-org/test-repo.git','ssh scheme with custom port' => 'ssh://[email protected]:2222/test-org/test-repo.git','https with different case' => 'https://github.com/Test-Org/Test-Repo.git',+ 'https under a sub-path' => 'https://git.example.com/gitea/test-org/test-repo.git',+ 'ssh scheme under a sub-path' => 'ssh://[email protected]:12345/gitea/test-org/test-repo.git',]);- test('signed pushes do not deploy applications for another repository', function (string $provider) {+ test('signed pushes do not deploy applications for another repository', function (string $provider, string $gitRepository) {Queue::fake();$application = makeWebhookApplicationServerFunctional(createApplicationWithWebhook(overrides: [- 'git_repository' => '[email protected]:2222/other-org/test-repo.git',+ 'git_repository' => $gitRepository,]));sendManualWebhookPush($this, $provider, $application)->assertOk();expect(ApplicationDeploymentQueue::query()->where('application_id', $application->id)->exists())->toBeFalse();- })->with(['github', 'gitlab', 'bitbucket', 'gitea']);+ })->with(['github', 'gitlab', 'bitbucket', 'gitea'])->with([+ 'other owner' => '[email protected]:2222/other-org/test-repo.git',+ 'owner that ends with the pushed owner' => 'https://git.example.com/other-test-org/test-repo.git',+ ]);});describe('Webhook Secret Auto-Generation', function () {diff --git a/tests/v4/Browser/RegistrationTest.php b/tests/v4/Browser/RegistrationTest.phpindex 62025924a9..d72c5653c3 100644--- a/tests/v4/Browser/RegistrationTest.php+++ b/tests/v4/Browser/RegistrationTest.php@@ -65,3 +65,21 @@ it('shows login link when a user already exists', function () {->assertDontSee('Full instance access')->screenshot(filename: 'registration-existing-user');});++it('keeps the auth card heading visible on short viewports', function (int $width, int $height) {+ $page = visit('/register')->resize($width, $height);++ $page->assertSee('Create account');++ $headingTop = $page->script('document.querySelector(".auth-card-heading h1").getBoundingClientRect().top');+ $submitBottom = $page->script('document.querySelector("button[type=submit]").getBoundingClientRect().bottom');+ $scrollHeight = $page->script('document.documentElement.scrollHeight');++ expect($headingTop)->toBeGreaterThanOrEqual(0)+ ->and($scrollHeight)->toBeGreaterThanOrEqual($submitBottom);++ $page->screenshot(filename: "registration-short-viewport-{$width}x{$height}");+})->with([+ 'issue 11100 viewport' => [1422, 612],+ 'short laptop viewport' => [1280, 480],+]);diff --git a/versions.json b/versions.jsonindex f96c7ef895..d3d63460e2 100644--- a/versions.json+++ b/versions.json@@ -28,4 +28,4 @@"v3.0": "3.0.4","v2.11": "2.11.60"}-}+}\ No newline at end of file