Skip to content

Commit

Permalink
update YAML path for HTTP TLS redactor
Browse files Browse the repository at this point in the history
  • Loading branch information
nvanthao committed Jan 3, 2025
1 parent 9e6affc commit 19c1d5a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/redact/redact.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,13 @@ func getRedactors(path string) ([]Redactor, error) {
// todo: any other TLS keys to redact?
tlsKeys := []string{"clientKey"}
for _, key := range tlsKeys {
yamlPath := fmt.Sprintf("spec.collectors.*.*.tls.%s", key)
redactors = append(redactors, NewYamlRedactor(yamlPath, constants.SPEC_FILENAME, "Redact TLS private key"))
yamlPaths := []string{
fmt.Sprintf("spec.collectors.*.*.tls.%s", key), // Database collector
fmt.Sprintf("spec.collectors.*.*.*.tls.%s", key), // HTTP collector
}
for _, yamlPath := range yamlPaths {
redactors = append(redactors, NewYamlRedactor(yamlPath, constants.SPEC_FILENAME, "Redact TLS private key"))
}
}

return redactors, nil
Expand Down
13 changes: 13 additions & 0 deletions pkg/supportbundle/supportbundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ func Test_saveAndRedactFinalSpec(t *testing.T) {
ClientKey: `PRIVATE KEY`,
},
},
HTTP: &troubleshootv1beta2.HTTP{
Get: &troubleshootv1beta2.Get{
URL: "http:api:3000/healthz",
TLS: &troubleshootv1beta2.TLSParams{
ClientKey: `PRIVATE KEY`,
},
},
},
},
},
}
Expand All @@ -157,6 +165,11 @@ spec:
cacert: CA CERT
clientCert: CLIENT CERT
clientKey: "***HIDDEN***"
http:
get:
url: http:api:3000/healthz
tls:
clientKey: "***HIDDEN***"
status: {}
`

Expand Down

0 comments on commit 19c1d5a

Please sign in to comment.