MCPcopy Create free account
hub / github.com/bytebase/bytebase / redactDataSource

Function redactDataSource

backend/api/v1/audit.go:670–719  ·  view source on GitHub ↗
(d *v1pb.DataSource)

Source from the content-addressed store, hash-verified

668}
669
670func redactDataSource(d *v1pb.DataSource) *v1pb.DataSource {
671 // Clone the datasource to avoid modifying the original
672 cloned, ok := proto.Clone(d).(*v1pb.DataSource)
673 if !ok {
674 return d
675 }
676 if cloned.Password != "" {
677 cloned.Password = maskedString
678 }
679 if cloned.SslCa != "" {
680 cloned.SslCa = maskedString
681 }
682 if cloned.SslCaPath != "" {
683 cloned.SslCaPath = maskedString
684 }
685 if cloned.SslCert != "" {
686 cloned.SslCert = maskedString
687 }
688 if cloned.SslCertPath != "" {
689 cloned.SslCertPath = maskedString
690 }
691 if cloned.SslKey != "" {
692 cloned.SslKey = maskedString
693 }
694 if cloned.SslKeyPath != "" {
695 cloned.SslKeyPath = maskedString
696 }
697 if cloned.SshPassword != "" {
698 cloned.SshPassword = maskedString
699 }
700 if cloned.SshPrivateKey != "" {
701 cloned.SshPrivateKey = maskedString
702 }
703 if cloned.AuthenticationPrivateKey != "" {
704 cloned.AuthenticationPrivateKey = maskedString
705 }
706 if cloned.ExternalSecret != nil {
707 cloned.ExternalSecret = new(v1pb.DataSourceExternalSecret)
708 }
709 if cloned.SaslConfig != nil {
710 if krbConf := cloned.SaslConfig.GetKrbConfig(); krbConf != nil {
711 krbConf.Keytab = []byte(maskedString)
712 cloned.SaslConfig.Mechanism = &v1pb.SASLConfig_KrbConfig{KrbConfig: krbConf}
713 }
714 }
715 if cloned.MasterPassword != "" {
716 cloned.MasterPassword = maskedString
717 }
718 return cloned
719}
720
721func redactAdminExecuteResponse(r *v1pb.AdminExecuteResponse) *v1pb.AdminExecuteResponse {
722 if r == nil {

Callers 2

getRequestStringFunction · 0.85
redactInstanceFunction · 0.85

Calls 1

GetKrbConfigMethod · 0.45

Tested by

no test coverage detected