Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(kuma-cp): remove value of secret when logging Secret Resources #5384

Merged
merged 9 commits into from
Dec 1, 2022
5 changes: 5 additions & 0 deletions api/system/v1alpha1/secret_helper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package v1alpha1

func (s *Secret) MarshalLog() interface{} {
return "***"
}
32 changes: 32 additions & 0 deletions pkg/core/resources/apis/system/secret_resource_helper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package system

import (
"github.com/kumahq/kuma/pkg/core/resources/model"
)

type secretResource struct {
Meta model.ResourceMeta
Spec string
}

func (l *SecretResourceList) MarshalLog() interface{} {
list := make([]secretResource, len(l.Items))
for _, res := range l.Items {
list = append(list, secretResource{
Meta: res.GetMeta(),
Spec: "***",
})
}
return list
}

func (l *GlobalSecretResourceList) MarshalLog() interface{} {
list := make([]secretResource, len(l.Items))
for _, res := range l.Items {
list = append(list, secretResource{
Meta: res.GetMeta(),
Spec: "***",
})
}
return list
}