From aa77e3a8d372f1617f4f1cb7b4103f190cd850ec Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Mon, 16 Feb 2026 08:08:41 +0200 Subject: [PATCH] adjust port check --- app/jobs/send_test_webhook_request_job.rb | 2 +- lib/download_utils.rb | 3 ++- lib/send_webhook_request.rb | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/jobs/send_test_webhook_request_job.rb b/app/jobs/send_test_webhook_request_job.rb index fe5cabce..0116cdaf 100644 --- a/app/jobs/send_test_webhook_request_job.rb +++ b/app/jobs/send_test_webhook_request_job.rb @@ -26,7 +26,7 @@ class SendTestWebhookRequestJob Addressable::URI.parse(webhook_url.url).normalize end - raise HttpsError, 'Only HTTPS is allowed.' if uri.scheme != 'https' || uri.port != 443 + raise HttpsError, 'Only HTTPS is allowed.' if uri.scheme != 'https' || [443, nil].exclude?(uri.port) raise LocalhostError, "Can't send to localhost." if uri.host.in?(SendWebhookRequest::LOCALHOSTS) end diff --git a/lib/download_utils.rb b/lib/download_utils.rb index 3758239c..8b352502 100644 --- a/lib/download_utils.rb +++ b/lib/download_utils.rb @@ -52,7 +52,8 @@ module DownloadUtils end def validate_uri!(uri) - raise UnableToDownload, "Error loading: #{uri}. Only HTTPS is allowed." if uri.scheme != 'https' || uri.port != 443 + raise UnableToDownload, "Error loading: #{uri}. Only HTTPS is allowed." if uri.scheme != 'https' || + [443, nil].exclude?(uri.port) raise UnableToDownload, "Error loading: #{uri}. Can't download from localhost." if uri.host.in?(LOCALHOSTS) end diff --git a/lib/send_webhook_request.rb b/lib/send_webhook_request.rb index d41c8cbc..87de376a 100644 --- a/lib/send_webhook_request.rb +++ b/lib/send_webhook_request.rb @@ -22,7 +22,7 @@ module SendWebhookRequest end if Docuseal.multitenant? - raise HttpsError, 'Only HTTPS is allowed.' if (uri.scheme != 'https' || uri.port != 443) && + raise HttpsError, 'Only HTTPS is allowed.' if (uri.scheme != 'https' || [443, nil].exclude?(uri.port)) && !AccountConfig.exists?(key: :allow_http, account_id: webhook_url.account_id) raise LocalhostError, "Can't send to localhost." if uri.host.in?(LOCALHOSTS)