mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
test: gate webhook host validation to production env
Webhook E2E tests use the docker service name request-catcher-webhook as the target; that hostname does not resolve via standard DNS, so the new PublicHostname check rejects it. Same env gate Appwrite already uses elsewhere. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ec5b4ca565
commit
e42fe21ff9
1 file changed
+7
-5
@@ -103,11 +103,13 @@ class Webhooks extends Action
|
||||
|
||||
$url = \rawurldecode($webhook->getAttribute('url'));
|
||||
|
||||
$host = \parse_url($url, PHP_URL_HOST) ?? '';
|
||||
$hostnameValidator = new PublicHostname();
|
||||
if (!$hostnameValidator->isValid($host)) {
|
||||
$this->errors[] = 'Webhook target ' . $host . ' rejected: ' . $hostnameValidator->getDescription();
|
||||
return;
|
||||
if (System::getEnv('_APP_ENV', 'development') === 'production') {
|
||||
$host = \parse_url($url, PHP_URL_HOST) ?? '';
|
||||
$hostnameValidator = new PublicHostname();
|
||||
if (!$hostnameValidator->isValid($host)) {
|
||||
$this->errors[] = 'Webhook target ' . $host . ' rejected: ' . $hostnameValidator->getDescription();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$signatureKey = $webhook->getAttribute('signatureKey');
|
||||
|
||||
Reference in new issue
Block a user