Skip to content

Commit 57ecc28

Browse files
author
Evan Anderson
committed
Fix a missed map initialization. Also defend against this error in depth.
Signed-off-by: Evan Anderson <[email protected]>
1 parent 60522f8 commit 57ecc28

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/imgpkg/registry/registry.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ func (r SimpleRegistry) CloneWithLogger(_ util.ProgressLogger) Registry {
234234
refOpts: r.refOpts,
235235
keychain: r.keychain,
236236
roundTrippers: r.roundTrippers,
237+
authn: map[string]regauthn.Authenticator{},
237238
transportAccess: &sync.Mutex{},
238239
}
239240
}
@@ -276,6 +277,10 @@ func (r *SimpleRegistry) transport(ref regname.Reference, scope string) (http.Ro
276277
}
277278
}
278279

280+
if r.authn == nil {
281+
// This shouldn't happen, but let's defend in depth
282+
r.authn = map[string]regauthn.Authenticator{}
283+
}
279284
auth, ok := r.authn[registry.Name()]
280285
if !ok {
281286
regauth, err := r.keychain.Resolve(registry)

0 commit comments

Comments
 (0)