Files
coolify/resources/views/livewire/project/shared/webhooks.blade.php
T
Andras Bacsai 0ed423aaac feat(webhooks): require 16 characters for new manual webhook secrets
New or changed manual webhook secrets (GitHub, GitLab, Bitbucket,
Gitea) must have at least 16 characters, in the Webhooks page and in
the application API. Stored secrets keep working: an unchanged value
passes, and an empty value still disables the webhook. Each secret
field gets a Generate button that fills a random 40-character secret;
the user saves it after adding it to the Git provider.
2026-10-01 20:31:00 +02:00

125 lines
7.2 KiB
PHP

<div>
@if ($resource->type() === 'application')
@php
$manualWebhookProviders = [
[
'name' => 'GitHub',
'url' => $githubManualWebhook,
'key' => 'github',
'secret' => 'githubManualWebhookSecret',
'description' => 'Accepts JSON or form-urlencoded webhook payloads.',
],
[
'name' => 'GitLab',
'url' => $gitlabManualWebhook,
'key' => 'gitlab',
'secret' => 'gitlabManualWebhookSecret',
'description' => 'Use the same secret when configuring the webhook in GitLab.',
],
[
'name' => 'Bitbucket',
'url' => $bitbucketManualWebhook,
'key' => 'bitbucket',
'secret' => 'bitbucketManualWebhookSecret',
'description' => 'Use the same secret when configuring the webhook in Bitbucket.',
],
[
'name' => 'Gitea',
'url' => $giteaManualWebhook,
'key' => 'gitea',
'secret' => 'giteaManualWebhookSecret',
'description' => 'Use the same secret when configuring the webhook in Gitea.',
],
];
@endphp
<div class="flex flex-col gap-6">
<x-application.settings-section id="deploy-webhook-section" title="Deploy webhook"
helper="Trigger a deployment from an external service. Requests must include a valid Coolify API authorization token.">
<x-slot:actions>
<a class="button" href="https://coolify.io/docs/api-reference/authorization" target="_blank"
rel="noopener noreferrer">
Documentation
<x-external-link />
</a>
</x-slot:actions>
<x-forms.copy-input label="Deploy webhook URL" :text="$deploywebhook ?? ''" />
</x-application.settings-section>
@if ($githubManualWebhook && $gitlabManualWebhook)
<form wire:submit.prevent="submit" class="application-settings-form flex flex-col">
<x-unsaved-bar action="submit" />
<x-application.settings-section id="manual-git-webhooks-section" title="Manual Git webhooks"
helper="Configure these endpoints when the repository is not connected through an official Git App." flush>
<x-slot:actions>
@if (filled($resource?->gitWebhook))
<a class="button" href="{{ $resource->gitWebhook }}" target="_blank"
rel="noopener noreferrer">
Repository settings
<x-external-link />
</a>
@endif
</x-slot:actions>
<div class="divide-y divide-neutral-200 dark:divide-white/[0.07]">
@foreach ($manualWebhookProviders as $provider)
<section class="px-4 py-5 first:pt-4 last:pb-4"
wire:key="manual-webhook-{{ str($provider['name'])->slug() }}">
<div class="mb-4">
<h4 class="text-sm font-semibold text-black dark:text-fg">
{{ $provider['name'] }}
</h4>
<p class="mt-1 text-[13px] leading-5 text-neutral-500 dark:text-fg-dim">
{{ $provider['description'] }}
</p>
</div>
<div class="grid gap-4 md:grid-cols-2">
<x-forms.copy-input label="Webhook URL" :text="$provider['url'] ?? ''" />
@can('update', $resource)
<div class="flex items-end gap-2">
<x-forms.input type="password" :id="$provider['secret']"
label="Webhook secret"
helper="Must exactly match the secret configured in {{ $provider['name'] }}. New secrets need at least 16 characters. Leave empty to disable this webhook."
autocomplete="new-password" copyable />
<x-forms.button type="button"
x-on:click="$wire.generateSecret('{{ $provider['key'] }}').then((secret) => { if (typeof secret === 'string') { $wire.set('{{ $provider['secret'] }}', secret, false); } })"
aria-label="Generate {{ $provider['name'] }} webhook secret">
Generate
</x-forms.button>
</div>
@else
<x-forms.input disabled label="Webhook secret"
value="Hidden (only administrators can view)" />
@endcan
</div>
</section>
@endforeach
</div>
</x-application.settings-section>
</form>
@else
<x-application.settings-section id="manual-git-webhooks-section" title="Manual Git webhooks"
helper="Manual repository webhooks are only required when a repository is not connected through an official Git App.">
<x-empty size="sm" title="Managed by your Git App"
description="This application uses an official Git App, so Coolify configures repository webhooks automatically."
icon-name="notifications" />
</x-application.settings-section>
@endif
</div>
@else
<div class="application-settings-form">
<x-application.settings-section title="Deploy webhook"
helper="Trigger an external deployment with a valid Coolify API authorization token.">
<x-slot:actions>
<a class="button" href="https://coolify.io/docs/api-reference/authorization" target="_blank"
rel="noopener noreferrer">
Documentation
<x-external-link />
</a>
</x-slot:actions>
<x-forms.copy-input label="Deploy webhook URL" :text="$deploywebhook ?? ''" />
</x-application.settings-section>
</div>
@endif
</div>