From e4735627bdbee4dd749f261f094289e8af6e8843 Mon Sep 17 00:00:00 2001 From: Cooper de Nicola <47685358+cdenicola@users.noreply.github.com> Date: Sun, 2 Nov 2025 16:40:34 -0800 Subject: [PATCH 1/2] fix golangci-lint error G602 in caddyhttp --- modules/caddyhttp/reverseproxy/fastcgi/writer.go | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/caddyhttp/reverseproxy/fastcgi/writer.go b/modules/caddyhttp/reverseproxy/fastcgi/writer.go index 3af00d9a16f..c939ce804cd 100644 --- a/modules/caddyhttp/reverseproxy/fastcgi/writer.go +++ b/modules/caddyhttp/reverseproxy/fastcgi/writer.go @@ -112,6 +112,7 @@ func encodeSize(b []byte, size uint32) int { binary.BigEndian.PutUint32(b, size) return 4 } + // #nosec G602 - b input as [>=4]byte; index 0 is always in-bounds b[0] = byte(size) return 1 } From e5bc77034dc38c147da6d5db244364dd4c81599a Mon Sep 17 00:00:00 2001 From: Cooper de Nicola <47685358+cdenicola@users.noreply.github.com> Date: Sun, 2 Nov 2025 18:41:24 -0800 Subject: [PATCH 2/2] match nolint comment with PR#7324 --- modules/caddyhttp/reverseproxy/fastcgi/writer.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/caddyhttp/reverseproxy/fastcgi/writer.go b/modules/caddyhttp/reverseproxy/fastcgi/writer.go index c939ce804cd..225d8f5f83a 100644 --- a/modules/caddyhttp/reverseproxy/fastcgi/writer.go +++ b/modules/caddyhttp/reverseproxy/fastcgi/writer.go @@ -112,8 +112,7 @@ func encodeSize(b []byte, size uint32) int { binary.BigEndian.PutUint32(b, size) return 4 } - // #nosec G602 - b input as [>=4]byte; index 0 is always in-bounds - b[0] = byte(size) + b[0] = byte(size) //nolint:gosec // false positive; b is made 8 bytes long, then this function is always called with b being at least 4 or 1 byte long return 1 }