adjust port check
This commit is contained in:
@@ -26,7 +26,7 @@ class SendTestWebhookRequestJob
|
|||||||
Addressable::URI.parse(webhook_url.url).normalize
|
Addressable::URI.parse(webhook_url.url).normalize
|
||||||
end
|
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)
|
raise LocalhostError, "Can't send to localhost." if uri.host.in?(SendWebhookRequest::LOCALHOSTS)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ module DownloadUtils
|
|||||||
end
|
end
|
||||||
|
|
||||||
def validate_uri!(uri)
|
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)
|
raise UnableToDownload, "Error loading: #{uri}. Can't download from localhost." if uri.host.in?(LOCALHOSTS)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ module SendWebhookRequest
|
|||||||
end
|
end
|
||||||
|
|
||||||
if Docuseal.multitenant?
|
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,
|
!AccountConfig.exists?(key: :allow_http,
|
||||||
account_id: webhook_url.account_id)
|
account_id: webhook_url.account_id)
|
||||||
raise LocalhostError, "Can't send to localhost." if uri.host.in?(LOCALHOSTS)
|
raise LocalhostError, "Can't send to localhost." if uri.host.in?(LOCALHOSTS)
|
||||||
|
|||||||
Reference in New Issue
Block a user