Skip to content

Conversation

@rsdmike
Copy link
Member

@rsdmike rsdmike commented May 8, 2024

No description provided.

@codecov
Copy link

codecov bot commented May 8, 2024

Codecov Report

Attention: Patch coverage is 0% with 107 lines in your changes missing coverage. Please review.

Project coverage is 35.57%. Comparing base (15705da) to head (c2f7822).

Files Patch % Lines
internal/certificates/generate.go 0.00% 107 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #133      +/-   ##
==========================================
- Coverage   36.51%   35.57%   -0.95%     
==========================================
  Files          55       56       +1     
  Lines        4017     4124     +107     
==========================================
  Hits         1467     1467              
- Misses       2458     2565     +107     
  Partials       92       92              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rsdmike rsdmike force-pushed the main branch 5 times, most recently from e0ea0e5 to 62fb1d5 Compare May 23, 2024 04:44
func (s *Server) ListenAndServe() error {
config := &tls.Config{
Certificates: []tls.Certificate{s.certificates},
InsecureSkipVerify: true,

Check failure

Code scanning / CodeQL

Disabled TLS certificate check High

InsecureSkipVerify should not be used in production code.

Copilot Autofix

AI 15 days ago

The best way to fix this problem is to remove the InsecureSkipVerify: true setting from the TLS configuration on line 73 of ListenAndServe, ensuring that client certificates are properly validated. If certificate verification must be skipped in test environments, introduce a configuration/parameter/environment variable that determines whether to set InsecureSkipVerify: true, and default to verification in all production scenarios.

For the shown code, simply remove the line setting InsecureSkipVerify: true in the TLS config. If the application requires custom certificate validation for compatibility with Intel AMT or similar, consider handling validation using a custom verification function via the VerifyPeerCertificate field, but do not skip verification globally.

Change needed:

  • Edit file internal/controller/tcp/cira/tunnel.go, remove or comment out the line InsecureSkipVerify: true, in the TLS configuration inside the ListenAndServe function.

No new methods, definitions, or imports are needed.


Suggested changeset 1
internal/controller/tcp/cira/tunnel.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/internal/controller/tcp/cira/tunnel.go b/internal/controller/tcp/cira/tunnel.go
--- a/internal/controller/tcp/cira/tunnel.go
+++ b/internal/controller/tcp/cira/tunnel.go
@@ -70,7 +70,7 @@
 	config := &tls.Config{
 		Certificates: []tls.Certificate{s.certificates},
 		// ClientAuth:         tls.NoClientCert,
-		InsecureSkipVerify: true,
+		// InsecureSkipVerify: true, // Removed for security. Do not skip certificate verification.
 		MinVersion:         tls.VersionTLS12,
 	}
 
EOF
@@ -70,7 +70,7 @@
config := &tls.Config{
Certificates: []tls.Certificate{s.certificates},
// ClientAuth: tls.NoClientCert,
InsecureSkipVerify: true,
// InsecureSkipVerify: true, // Removed for security. Do not skip certificate verification.
MinVersion: tls.VersionTLS12,
}

Copilot is powered by AI and may make mistakes. Always verify output.
// Parse the authentication details from the original data
username, password, parseErr := s.parseAuthRequest(data)
if parseErr != nil {
log.Printf("Failed to parse authentication request: %v\n", parseErr)

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

Sensitive data returned by an access to passwordLen
flows to a logging call.

Copilot Autofix

AI 15 days ago

To fix the problem, we should ensure that sensitive data (such as the user-supplied password length) is not written in clear text to application logs, even as part of an error message. Instead, we should replace explicit values with a generic placeholder when constructing error strings related to parsing password authentication. Specifically, inside parseAuthRequest, all error messages that mention the value of the password length should be modified to avoid exposing this number; we can simply state "password too long" without including the actual length or, optionally, log only whether the value appears malformed.

The change should be made only to error construction inside parseAuthRequest — particularly the error case for password length on line 330 and any similar fields involving sensitive data. Only the relevant error string needs to be modified; the rest of the parsing logic remains unchanged.

No new imports or external libraries are needed for this fix.

Suggested changeset 1
internal/controller/tcp/cira/tunnel.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/internal/controller/tcp/cira/tunnel.go b/internal/controller/tcp/cira/tunnel.go
--- a/internal/controller/tcp/cira/tunnel.go
+++ b/internal/controller/tcp/cira/tunnel.go
@@ -327,7 +327,7 @@
 		}
 
 		if passwordLen > 256 {
-			return "", "", fmt.Errorf("password too long: %d", passwordLen)
+			return "", "", fmt.Errorf("password too long")
 		}
 
 		passwordBytes := make([]byte, passwordLen)
EOF
@@ -327,7 +327,7 @@
}

if passwordLen > 256 {
return "", "", fmt.Errorf("password too long: %d", passwordLen)
return "", "", fmt.Errorf("password too long")
}

passwordBytes := make([]byte, passwordLen)
Copilot is powered by AI and may make mistakes. Always verify output.
addresses Add Support for CIRA
Fixes #665
@rsdmike rsdmike changed the title Cira test feat: enable CIRA connection in console Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant