Skip to content

Commit

Permalink
obscure data in fleetshard-sync status logs (#1253)
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes94 authored Sep 12, 2023
1 parent f6d113e commit 9b50f74
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion fleetshard/pkg/central/reconciler/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ func (r *CentralReconciler) Reconcile(ctx context.Context, remoteCentral private
return nil, errors.Wrapf(err, "setting central reconcilation cache")
}

glog.Infof("Returning central status %+v", status)
logStatus := status
logStatus.Secrets = obscureSecrets(status.Secrets)
glog.Infof("Returning central status %+v", logStatus)

return status, nil
}
Expand Down Expand Up @@ -1603,3 +1605,13 @@ func NewCentralReconciler(k8sClient ctrlClient.Client, fleetmanagerClient *fleet
resourcesChart: resourcesChart,
}
}

func obscureSecrets(secrets map[string]string) map[string]string {
obscuredSecrets := make(map[string]string, len(secrets))

for key := range secrets {
obscuredSecrets[key] = "secret-value"
}

return obscuredSecrets
}

0 comments on commit 9b50f74

Please sign in to comment.