Skip to content

fix(load): pass NameOptions to name.ParseReference#4786

Open
ricardbejarano wants to merge 1 commit intosigstore:mainfrom
bejaratommy:fix/load-allow-http-registry
Open

fix(load): pass NameOptions to name.ParseReference#4786
ricardbejarano wants to merge 1 commit intosigstore:mainfrom
bejaratommy:fix/load-allow-http-registry

Conversation

@ricardbejarano
Copy link
Copy Markdown

Summary

Fixes #4134 (upstream: #4134).

LoadCmd was calling name.ParseReference(imageRef) without forwarding registry name options, so --allow-http-registry had no effect: cosign always attempted a TLS handshake and the connection to a plain-HTTP registry failed with:

http: server gave HTTP response to HTTPS client

Root cause

RegistryOptions already has a NameOptions() helper that returns name.Insecure when AllowHTTPRegistry is true. The symmetric commands save, clean, and tree all call it correctly; load was the only command that missed it.

Fix

Pass opts.Registry.NameOptions()... to name.ParseReference in LoadCmd, matching the pattern used by the other commands.

-	ref, err := name.ParseReference(imageRef)
+	ref, err := name.ParseReference(imageRef, opts.Registry.NameOptions()...)

Testing

Added TestLoadCmdAllowHTTPRegistry in cmd/cosign/cli/load_test.go. The test spins up an in-process plain-HTTP registry via net/http/httptest and go-containerregistry/pkg/registry, then verifies:

  • With AllowHTTPRegistry: true: the command reaches the registry over HTTP (no TLS error).
  • With AllowHTTPRegistry: false: the command fails to connect (expected behaviour for an HTTP-only registry).

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>
@ricardbejarano ricardbejarano requested a review from a team as a code owner April 1, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cosign load does ignore --allow-http-registry

2 participants