Clone created entities that were inserted into memdb... (#16487)

* Clone created entities that were inserted into memdb to prevent possibility of data race.
This commit is contained in:
Nick Cabatoff 2022-07-28 09:43:24 -04:00 committed by GitHub
parent b9181077fd
commit 488858e919
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

3
changelog/16487.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
identity: Prevent possibility of data races on entity creation.
```

View File

@ -1094,7 +1094,7 @@ func (i *IdentityStore) CreateEntity(ctx context.Context) (*identity.Entity, err
nsLabel, nsLabel,
}) })
return entity, nil return entity.Clone()
} }
// CreateOrFetchEntity creates a new entity. This is used by core to // CreateOrFetchEntity creates a new entity. This is used by core to