Skip to content

Commit

Permalink
Fix a missed map initialization. Also defend against this error in de…
Browse files Browse the repository at this point in the history
…pth.

Signed-off-by: Evan Anderson <evana@vmware.com>
  • Loading branch information
Evan Anderson committed Feb 13, 2023
1 parent 60522f8 commit 57ecc28
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/imgpkg/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ func (r SimpleRegistry) CloneWithLogger(_ util.ProgressLogger) Registry {
refOpts: r.refOpts,
keychain: r.keychain,
roundTrippers: r.roundTrippers,
authn: map[string]regauthn.Authenticator{},
transportAccess: &sync.Mutex{},
}
}
Expand Down Expand Up @@ -276,6 +277,10 @@ func (r *SimpleRegistry) transport(ref regname.Reference, scope string) (http.Ro
}
}

if r.authn == nil {
// This shouldn't happen, but let's defend in depth
r.authn = map[string]regauthn.Authenticator{}
}
auth, ok := r.authn[registry.Name()]
if !ok {
regauth, err := r.keychain.Resolve(registry)
Expand Down

0 comments on commit 57ecc28

Please sign in to comment.