From 24f7fc7c48c40ecd49afbe8b25627b079b141734 Mon Sep 17 00:00:00 2001 From: Aryan Behmardi Date: Wed, 10 Dec 2025 18:48:47 +0000 Subject: [PATCH 1/2] fix: add HTTP server timeouts for local network test helper (G114) Signed-off-by: Aryan Behmardi --- .golangci.yml | 2 +- internal/network_test_utils.go | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index a8b88ab06..339bf9e7b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -25,7 +25,7 @@ issues: exclude: - G104 # Errors unhandled - G103 # Use of unsafe calls should be audited - - G114 # Use of net/http serve function without timeouts. + # - G114 # Use of net/http serve function without timeouts. - G115 # Integer overflow conversion should be audited - G204 # Subprocess launched with variable - G301 # Expect directory permissions to be 0750 or less diff --git a/internal/network_test_utils.go b/internal/network_test_utils.go index 200e24384..77aa01a9b 100644 --- a/internal/network_test_utils.go +++ b/internal/network_test_utils.go @@ -21,6 +21,7 @@ import ( "net/http" "os/exec" "testing" + "time" "github.com/miekg/dns" "golang.org/x/sync/errgroup" @@ -132,7 +133,14 @@ func (l localNetworkServices) Serve(ctx context.Context) error { }) } - return http.ListenAndServe(l.ipAddr+":80", nil) + srv := &http.Server{ + Addr: l.ipAddr + ":80", + Handler: nil, + ReadTimeout: 5 * time.Second, + WriteTimeout: 5 * time.Second, + IdleTimeout: 30 * time.Second, + } + return srv.ListenAndServe() }) return errGroup.Wait() From e74c9449f0c2fdef9b819cd5b668ab08c4e3b7c4 Mon Sep 17 00:00:00 2001 From: Aryan Behmardi Date: Thu, 11 Dec 2025 23:19:22 +0000 Subject: [PATCH 2/2] removed G114 from .golangci.yml Signed-off-by: Aryan Behmardi --- .golangci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 339bf9e7b..a2fba7eb5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -25,7 +25,6 @@ issues: exclude: - G104 # Errors unhandled - G103 # Use of unsafe calls should be audited - # - G114 # Use of net/http serve function without timeouts. - G115 # Integer overflow conversion should be audited - G204 # Subprocess launched with variable - G301 # Expect directory permissions to be 0750 or less