Skip to content

Commit 28eef5f

Browse files
Copilotillume
andcommitted
Further redact error messages for maximum security
- Remove scheme+host from non-https error message - Remove path from path validation error message - All error messages now completely redact user input - Prevents any potential information disclosure - All 14 validation tests still pass Final security hardening per code review feedback. Co-authored-by: illume <9541+illume@users.noreply.github.com>
1 parent 8d7a767 commit 28eef5f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

backend/pkg/kubeconfig/kubeconfig.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,10 +1018,9 @@ func validateAPIServerEndpoint(endpoint string) (string, error) {
10181018
}
10191019

10201020
if parsedURL.Scheme != "https" {
1021-
// Safe to include scheme+host as it doesn't contain secrets
1021+
// Don't include scheme or host to avoid any information disclosure
10221022
return "", fmt.Errorf(
1023-
"invalid custom API server endpoint %s://%s: must be a full https:// URL",
1024-
parsedURL.Scheme, parsedURL.Host,
1023+
"invalid custom API server endpoint: must be a full https:// URL (non-https scheme detected)",
10251024
)
10261025
}
10271026

@@ -1046,10 +1045,9 @@ func validateAPIServerEndpoint(endpoint string) (string, error) {
10461045
}
10471046

10481047
if parsedURL.Path != "" && parsedURL.Path != "/" {
1049-
// Safe to include scheme+host+path as path shouldn't contain secrets
1048+
// Don't include path to avoid potential sensitive information
10501049
return "", fmt.Errorf(
1051-
"invalid custom API server endpoint https://%s%s: path must be empty or '/' (scheme+host[:port] only)",
1052-
parsedURL.Host, parsedURL.Path,
1050+
"invalid custom API server endpoint: path must be empty or '/' (scheme+host[:port] only)",
10531051
)
10541052
}
10551053

0 commit comments

Comments
 (0)