mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-03 20:40:45 -05:00
Fix static secret caching race condition (#28494)
* Fix static ssecret caching data race * Fix static ssecret caching data race * Changelog
This commit is contained in:
parent
7cf6cbd330
commit
6d66990cb6
2 changed files with 5 additions and 0 deletions
3
changelog/28494.txt
Normal file
3
changelog/28494.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
proxy/cache (enterprise): Fixed a data race that could occur while tracking capabilities in Proxy's static secret cache.
|
||||
```
|
||||
|
|
@ -791,6 +791,7 @@ func (c *LeaseCache) storeStaticSecretIndex(ctx context.Context, req *SendReques
|
|||
|
||||
path := getStaticSecretPathFromRequest(req)
|
||||
|
||||
capabilitiesIndex.IndexLock.Lock()
|
||||
// Extra caution -- avoid potential nil
|
||||
if capabilitiesIndex.ReadablePaths == nil {
|
||||
capabilitiesIndex.ReadablePaths = make(map[string]struct{})
|
||||
|
|
@ -798,6 +799,7 @@ func (c *LeaseCache) storeStaticSecretIndex(ctx context.Context, req *SendReques
|
|||
|
||||
// update the index with the new capability:
|
||||
capabilitiesIndex.ReadablePaths[path] = struct{}{}
|
||||
capabilitiesIndex.IndexLock.Unlock()
|
||||
|
||||
err = c.SetCapabilitiesIndex(ctx, capabilitiesIndex)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue