Redact secrets using "+" rather than "*" as this is base 64 compatiba… (#2119)

This commit is contained in:
Alex Collins 2019-08-08 14:45:27 -07:00 committed by GitHub
parent d2e98df607
commit 9c8ab50d60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View file

@ -284,7 +284,7 @@ func TestAppWithSecrets(t *testing.T) {
diffOutput, err := fixture.RunCli("app", "diff", app.Name)
assert.Error(t, err)
assert.Contains(t, diffOutput, "username: '*********'")
assert.Contains(t, diffOutput, "username: +++++++++")
// local diff should ignore secrets
diffOutput, err = fixture.RunCli("app", "diff", app.Name, "--local", "testdata/secrets")

View file

@ -387,7 +387,8 @@ func HideSecretData(target *unstructured.Unstructured, live *unstructured.Unstru
}
for k := range keys {
nextReplacement := "*********"
// we use "+" rather than the more common "*"
nextReplacement := "+++++++++"
valToReplacement := make(map[string]string)
for _, obj := range []*unstructured.Unstructured{target, live, orig} {
var data map[string]interface{}
@ -409,7 +410,7 @@ func HideSecretData(target *unstructured.Unstructured, live *unstructured.Unstru
replacement, ok := valToReplacement[val]
if !ok {
replacement = nextReplacement
nextReplacement = nextReplacement + "*"
nextReplacement = nextReplacement + "+"
valToReplacement[val] = replacement
}
data[k] = replacement

View file

@ -534,9 +534,9 @@ func secretData(obj *unstructured.Unstructured) map[string]interface{} {
}
const (
replacement1 = "*********"
replacement2 = "**********"
replacement3 = "***********"
replacement1 = "+++++++++"
replacement2 = "++++++++++"
replacement3 = "+++++++++++"
)
func TestHideSecretDataSameKeysDifferentValues(t *testing.T) {