fix: update copyright year and add password placeholder handling in store update

This commit is contained in:
rick 2025-02-27 10:39:53 +00:00
parent 255579bd23
commit d04519d6b6
3 changed files with 9 additions and 2 deletions

View File

@ -1161,7 +1161,7 @@ func (s *server) GetStores(ctx context.Context, in *Empty) (reply *Stores, err e
storeStatus, sErr := s.VerifyStore(ctx, &SimpleQuery{Name: item.Name})
grpcStore.Ready = sErr == nil && storeStatus.Ready
grpcStore.ReadOnly = storeStatus.ReadOnly
grpcStore.Password = "******" // return a placeholder instead of the actual value for the security reason
grpcStore.Password = util.PasswordPlaceholder
reply.Data = append(reply.Data, grpcStore)
}

View File

@ -26,6 +26,7 @@ package testing
import (
"fmt"
"github.com/linuxsuren/api-testing/pkg/util"
"os"
"path"
"strings"
@ -186,6 +187,10 @@ func (s *storeFactory) UpdateStore(store Store) (err error) {
for i := range storeConfig.Stores {
item := storeConfig.Stores[i]
if item.Name == store.Name {
if store.Password == util.PasswordPlaceholder {
// the password is not changed
store.Password = storeConfig.Stores[i].Password
}
storeConfig.Stores[i] = store
exist = true
break

View File

@ -1,5 +1,5 @@
/*
Copyright 2023 API Testing Authors.
Copyright 2023-2025 API Testing Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -82,3 +82,5 @@ const (
Plain = "text/plain"
Authorization = "Authorization"
)
const PasswordPlaceholder = "******"