-
Notifications
You must be signed in to change notification settings - Fork 10
feat: enable CIRA connection in console #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
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. |
e0ea0e5 to
62fb1d5
Compare
| 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
Show autofix suggestion
Hide autofix suggestion
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 lineInsecureSkipVerify: true,in the TLS configuration inside theListenAndServefunction.
No new methods, definitions, or imports are needed.
-
Copy modified line R73
| @@ -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, | ||
| } | ||
|
|
| // 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
Show autofix suggestion
Hide autofix suggestion
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.
-
Copy modified line R330
| @@ -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) |
addresses Add Support for CIRA Fixes #665
No description provided.