fix(load): pass NameOptions to name.ParseReference#4786
Open
ricardbejarano wants to merge 1 commit intosigstore:mainfrom
Open
fix(load): pass NameOptions to name.ParseReference#4786ricardbejarano wants to merge 1 commit intosigstore:mainfrom
ricardbejarano wants to merge 1 commit intosigstore:mainfrom
Conversation
LoadCmd was calling name.ParseReference without the name.Insecure option, so --allow-http-registry had no effect: the command always tried to connect over HTTPS regardless of the flag. The RegistryOptions.NameOptions() helper already returns name.Insecure when AllowHTTPRegistry is set; the load command simply wasn't calling it, unlike the symmetric save, clean, and tree commands which do. Pass opts.Registry.NameOptions()... to name.ParseReference so that plain-HTTP registries are reachable when the flag is supplied. Fixes sigstore#4134 Signed-off-by: Tommy <tommy@bejara.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4134 (upstream: #4134).
LoadCmdwas callingname.ParseReference(imageRef)without forwarding registry name options, so--allow-http-registryhad no effect: cosign always attempted a TLS handshake and the connection to a plain-HTTP registry failed with:Root cause
RegistryOptionsalready has aNameOptions()helper that returnsname.InsecurewhenAllowHTTPRegistryistrue. The symmetric commandssave,clean, andtreeall call it correctly;loadwas the only command that missed it.Fix
Pass
opts.Registry.NameOptions()...toname.ParseReferenceinLoadCmd, matching the pattern used by the other commands.Testing
Added
TestLoadCmdAllowHTTPRegistryincmd/cosign/cli/load_test.go. The test spins up an in-process plain-HTTP registry vianet/http/httptestandgo-containerregistry/pkg/registry, then verifies:AllowHTTPRegistry: true: the command reaches the registry over HTTP (no TLS error).AllowHTTPRegistry: false: the command fails to connect (expected behaviour for an HTTP-only registry).