@marcel91200 / caddy Mirror · read-only / commits / b377208e
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 12, 23:15 UTC

chore: Appease gosec linter (#5777)

These happen to be harmless memory aliasing but I guess the linter can't know that and we can't really prove it in general.

Matt Holt committed Aug 23, 2023 at 20:47 UTC b377208ededa964893dedd5660734e9616f998f7
2 files changed +4 -2
modules/caddyhttp/reverseproxy/httptransport.go
+2 -1
@@ -529,7 +529,8 @@ func (t TLSConfig) MakeTLSClientConfig(ctx caddy.Context) (*tls.Config, error) {
529 certs := caddytls.AllMatchingCertificates(t.ClientCertificateAutomate)
530 var err error
531 for _, cert := range certs {
532 - err = cri.SupportsCertificate(&cert.Certificate)
532 + certCertificate := cert.Certificate // avoid taking address of iteration variable (gosec warning)
533 + err = cri.SupportsCertificate(&certCertificate)
534 if err == nil {
535 return &cert.Certificate, nil
536 }
modules/caddytls/certselection.go
+2 -1
@@ -58,7 +58,8 @@ nextChoice:
58 if len(p.SerialNumber) > 0 {
59 var found bool
60 for _, sn := range p.SerialNumber {
61 - if cert.Leaf.SerialNumber.Cmp(&sn.Int) == 0 {
61 + snInt := sn.Int // avoid taking address of iteration variable (gosec warning)
62 + if cert.Leaf.SerialNumber.Cmp(&snInt) == 0 {
63 found = true
64 break
65 }