Bug UpdateInfraEnvInternal should not log InfraEnvUpdateParams.PullSecret
This change updates UpdateInfraEnvInternal to hide InfraEnvUpdateParams.PullSecret
print when printing InfraEnvUpdateParams. Instead, it will print:
"pull secret was updated but will not be printed for security reasons."
@@ -5749,8 +5749,20 @@ func (b *bareMetalInventory) UpdateInfraEnvInternal(ctx context.Context, params
log := logutil.FromContext(ctx, b.log)
var infraEnv *common.InfraEnv
var err error
+ var pullSecretBackup string
+ pullSecretUpdated := false
+
+ if params.InfraEnvUpdateParams.PullSecret != "" {
+ pullSecretUpdated = true
+ pullSecretBackup = params.InfraEnvUpdateParams.PullSecret
+ params.InfraEnvUpdateParams.PullSecret = "pull secret was updated but will not be printed for security reasons."
+ }
log.Infof("update infraEnv %s with params: %+v", params.InfraEnvID, params.InfraEnvUpdateParams)
+ if pullSecretUpdated {
+ params.InfraEnvUpdateParams.PullSecret = pullSecretBackup
+ }
+
if params, err = b.validateAndUpdateInfraEnvParams(ctx, &params); err != nil {
return nil, common.NewApiError(http.StatusBadRequest, err)
}
