mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-04 10:42:23 +00:00
fix(webhook): match repositories under self-hosted sub-paths
This commit is contained in:
1 parent
0eb78dcf9b
commit
3b92248309
4 files changed
+34
-5
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -932,18 +932,23 @@ describe('Manual Webhook Repository Matching', function () {
|
||||
'scp-style with custom user and port' => 'custom-user@git.example.com:2222/test-org/test-repo.git',
|
||||
'ssh scheme with custom port' => 'ssh://git@10.0.0.80: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://gitea@git.example.com: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' => 'git@10.0.0.80: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' => 'git@10.0.0.80: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 () {
|
||||
|
||||
@@ -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],
|
||||
]);
|
||||
+1
-1
@@ -28,4 +28,4 @@
|
||||
"v3.0": "3.0.4",
|
||||
"v2.11": "2.11.60"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user