fix: return missing information in cluster get API (#25566)

Signed-off-by: Patroklos Papapetrou <ppapapetrou76@gmail.com>
This commit is contained in:
Papapetrou Patroklos
2026-01-26 20:37:50 +02:00
committed by GitHub
parent 3811a30949
commit 19a74df8dc
2 changed files with 17 additions and 4 deletions

View File

@@ -2298,8 +2298,14 @@ func (c *Cluster) Sanitized() *Cluster {
ProxyUrl: c.Config.ProxyUrl,
DisableCompression: c.Config.DisableCompression,
TLSClientConfig: TLSClientConfig{
Insecure: c.Config.Insecure,
Insecure: c.Config.Insecure,
ServerName: c.Config.ServerName,
},
// We can't know what the user has put into args or
// env vars on the exec provider that might be sensitive
// (e.g. --private-key=XXX, PASSWORD=XXX)
// Implicitly assumes the command executable name is non-sensitive
ExecProviderConfig: nil,
},
}
}

View File

@@ -4892,10 +4892,16 @@ func TestSanitized(t *testing.T) {
Password: "password123",
BearerToken: "abc",
TLSClientConfig: TLSClientConfig{
Insecure: true,
Insecure: true,
ServerName: "server",
CertData: []byte("random bytes we don't want to show in the API response"),
KeyData: []byte("random bytes we don't want to show in the API response"),
CAData: []byte("random bytes we don't want to show in the API response"),
},
ExecProviderConfig: &ExecProviderConfig{
Command: "test",
Command: "this should be omitted in API",
Args: []string{"this should be omitted in API"},
APIVersion: "this should be omitted in API",
},
},
}
@@ -4921,7 +4927,8 @@ func TestSanitized(t *testing.T) {
Annotations: map[string]string{"annotation-key": "annotation-value"},
Config: ClusterConfig{
TLSClientConfig: TLSClientConfig{
Insecure: true,
Insecure: true,
ServerName: "server",
},
},
}, cluster.Sanitized())