mirror of
https://github.com/argoproj/argo-cd
synced 2026-05-23 09:18:26 +00:00
Redact secrets using "+" rather than "*" as this is base 64 compatiba… (#2119)
This commit is contained in:
parent
d2e98df607
commit
9c8ab50d60
3 changed files with 7 additions and 6 deletions
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -534,9 +534,9 @@ func secretData(obj *unstructured.Unstructured) map[string]interface{} {
|
|||
}
|
||||
|
||||
const (
|
||||
replacement1 = "*********"
|
||||
replacement2 = "**********"
|
||||
replacement3 = "***********"
|
||||
replacement1 = "+++++++++"
|
||||
replacement2 = "++++++++++"
|
||||
replacement3 = "+++++++++++"
|
||||
)
|
||||
|
||||
func TestHideSecretDataSameKeysDifferentValues(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue