From 9529905875e5d6a342a43357c802d45492164d7f Mon Sep 17 00:00:00 2001 From: remoteexception <35626357+remoteexception@users.noreply.github.com> Date: Thu, 9 Sep 2021 20:06:49 +0200 Subject: [PATCH] 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 --- pkg/modules/api/middlewares_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/modules/api/middlewares_test.go b/pkg/modules/api/middlewares_test.go index fc61def7..6c4a68c4 100644 --- a/pkg/modules/api/middlewares_test.go +++ b/pkg/modules/api/middlewares_test.go @@ -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))