File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -637,9 +637,17 @@ func verifyServerCertificate(rawCerts [][]byte, _ [][]*x509.Certificate) error {
637637 return fmt .Errorf ("insecure connection to secure service" )
638638}
639639
640+ // generateClientTLSConfig creates a TLS config for non-TLS mode connections.
641+ // This is only called when no TLS configuration is provided (see DialContext).
642+ // Receptor supports both TLS and non-TLS connections per the documentation.
643+ // When TLS is configured, users provide their own tls.Config via GetClientTLSConfig.
644+ // InsecureSkipVerify is intentionally true here because:
645+ // 1. This path is for non-TLS mode where the server uses auto-generated self-signed certs
646+ // 2. Custom verification is still performed via VerifyPeerCertificate callback
647+ // 3. The callback (verifyServerCertificate) checks for the insecure connection marker.
640648func generateClientTLSConfig (host string ) * tls.Config {
641649 return & tls.Config {
642- // #nosec G402 -- InsecureSkipVerify is set true in test context only; production usage is config-driven.
650+ //nolint:gosec // G402: InsecureSkipVerify is intentional for non-TLS mode; see function comment above
643651 InsecureSkipVerify : true ,
644652 VerifyPeerCertificate : verifyServerCertificate ,
645653 NextProtos : []string {"netceptor" },
You can’t perform that action at this time.
0 commit comments