Skip to content

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.

fix(webhook): match manual webhook repositories case-insensitively

Andras Bacsai809d9b21fa96
diff --git a/app/Http/Controllers/Webhook/Concerns/MatchesManualWebhookApplications.php b/app/Http/Controllers/Webhook/Concerns/MatchesManualWebhookApplications.php
index e3a5e98908..f1fd0c40f6 100644
--- a/app/Http/Controllers/Webhook/Concerns/MatchesManualWebhookApplications.php
+++ b/app/Http/Controllers/Webhook/Concerns/MatchesManualWebhookApplications.php
@@ -42,7 +42,13 @@ trait MatchesManualWebhookApplications
{
$repositoryPath = $this->canonicalManualWebhookRepository($gitRepository);
- return $repositoryPath !== null && hash_equals($fullName, $repositoryPath);
+ if ($repositoryPath === null) {
+ return false;
+ }
+
+ // 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));
}
/**
diff --git a/tests/Feature/Webhook/WebhookHmacTest.php b/tests/Feature/Webhook/WebhookHmacTest.php
index 24d9ed72ae..be2417462b 100644
--- a/tests/Feature/Webhook/WebhookHmacTest.php
+++ b/tests/Feature/Webhook/WebhookHmacTest.php
@@ -508,6 +508,29 @@ describe('Manual Webhook Repository Matching', function () {
$response->assertOk();
expect($response->getContent())->not->toContain('No applications found');
});
+
+ test('github matches repository case-insensitively', function () {
+ $app = createApplicationWithWebhook(overrides: [
+ 'git_repository' => 'https://github.com/Test-Org/Test-Repo.git',
+ ]);
+ $secret = $app->manual_webhook_secret_github;
+
+ $payload = json_encode([
+ 'ref' => 'refs/heads/main',
+ 'repository' => ['full_name' => 'test-org/test-repo'],
+ 'after' => 'abc123',
+ 'commits' => [],
+ ]);
+
+ $response = $this->call('POST', '/webhooks/source/github/events/manual', [], [], [], [
+ 'HTTP_X-GitHub-Event' => 'push',
+ 'HTTP_X-Hub-Signature-256' => 'sha256='.hash_hmac('sha256', $payload, $secret),
+ 'CONTENT_TYPE' => 'application/json',
+ ], $payload);
+
+ $response->assertOk();
+ expect($response->getContent())->not->toContain('No applications found');
+ });
});
describe('Webhook Secret Auto-Generation', function () {