From c99cb34971cd3e5cd0b094bcdb0ca0118438c7cc Mon Sep 17 00:00:00 2001 From: Dan Duvall Date: Wed, 18 May 2022 15:40:48 -0700 Subject: [PATCH] authprovider: synchronize all authConfigCache access Signed-off-by: Dan Duvall --- session/auth/authprovider/authprovider.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/session/auth/authprovider/authprovider.go b/session/auth/authprovider/authprovider.go index ac388fda2..e099dacf7 100644 --- a/session/auth/authprovider/authprovider.go +++ b/session/auth/authprovider/authprovider.go @@ -182,9 +182,9 @@ func (ap *authProvider) VerifyTokenAuthority(ctx context.Context, req *auth.Veri } func (ap *authProvider) getAuthConfig(host string) (*types.AuthConfig, error) { + ap.mu.Lock() + defer ap.mu.Unlock() if _, exists := ap.authConfigCache[host]; !exists { - ap.mu.Lock() - defer ap.mu.Unlock() if host == "registry-1.docker.io" { host = "https://index.docker.io/v1/" }