fix: only use webhook ports between 1025 and 65536 (#346)

- ports between 0 and 1024 can only be used by root in some OS

Co-authored-by: Jana Storch <jana.storch@dpdhl.com>
This commit is contained in:
remoteexception
2021-09-09 20:06:49 +02:00
committed by GitHub
parent eef7fc4b51
commit 9529905875

View File

@@ -111,7 +111,7 @@ func TestHttpErrorHandler(t *testing.T) {
func() {
rand.Seed(time.Now().UnixNano())
webhookPort := rand.Intn(65535-1+1) + 1
webhookPort := rand.Intn(65535 - 1025 + 1) + 1025
tc.webhookClient.errorURL = fmt.Sprintf(tc.webhookClient.errorURL, webhookPort)
@@ -825,7 +825,7 @@ func TestContextMiddlewareWithWebhook(t *testing.T) {
webhook.HidePort = true
rand.Seed(time.Now().UnixNano())
webhookPort := rand.Intn(65535-1+1) + 1
webhookPort := rand.Intn(65535 - 1025 + 1) + 1025
if tc.autoWebhookURLs {
c.Request().Header.Set("Gotenberg-Webhook-Url", fmt.Sprintf("http://localhost:%d/", webhookPort))