fix: credential data corruption - Create handler mutating store pointer
- CreateCredential was setting cred.Data = cred.Masked directly on the store pointer, corrupting stored credentials with masked data - Fixed by using a value copy for API response - Also fix nextID starts at 1 to avoid ID=0 issue
This commit is contained in:
@@ -71,8 +71,9 @@ var CredStore *CredentialStore
|
||||
// InitCredentialStore initializes the credential store
|
||||
func InitCredentialStore(cfg *Config) {
|
||||
CredStore = &CredentialStore{
|
||||
data: make(map[uint]*Credential),
|
||||
path: cfg.DataDir + "/credentials.json",
|
||||
data: make(map[uint]*Credential),
|
||||
path: cfg.DataDir + "/credentials.json",
|
||||
nextID: 1,
|
||||
}
|
||||
|
||||
if err := CredStore.Load(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user