pkg/name: only treat .localhost as non-HTTPS, not .local#2281
Merged
Subserial merged 3 commits intoApr 29, 2026
Conversation
The reLocal regex previously matched both .local and .localhost domain suffixes, treating both as insecure (HTTP) registries. This caused intermittent failures for users with FQDN registries ending in .local, as the HTTP fallback path would trigger incorrect redirect behavior. Only .localhost domains should be treated as non-HTTPS by default. Users with .local domains that genuinely need HTTP can still pass the Insecure option explicitly. Fixes google#2139
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
TestPingHttpFallback used ko.local which no longer triggers the HTTP fallback after the regex fix in pkg/name. Changed to ko.localhost to match the updated behavior.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2281 +/- ##
=======================================
Coverage 56.82% 56.82%
=======================================
Files 166 166
Lines 11279 11279
=======================================
Hits 6409 6409
Misses 4103 4103
Partials 767 767 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Subserial
approved these changes
Apr 29, 2026
Subserial
pushed a commit
to Subserial/go-containerregistry
that referenced
this pull request
May 15, 2026
* pkg/name: only treat .localhost as non-HTTPS, not .local The reLocal regex previously matched both .local and .localhost domain suffixes, treating both as insecure (HTTP) registries. This caused intermittent failures for users with FQDN registries ending in .local, as the HTTP fallback path would trigger incorrect redirect behavior. Only .localhost domains should be treated as non-HTTPS by default. Users with .local domains that genuinely need HTTP can still pass the Insecure option explicitly. Fixes google#2139 * pkg/v1/remote/transport: update ping test to use .localhost TestPingHttpFallback used ko.local which no longer triggers the HTTP fallback after the regex fix in pkg/name. Changed to ko.localhost to match the updated behavior.
6 tasks
ab-ghosh
added a commit
to ab-ghosh/chains
that referenced
this pull request
May 26, 2026
go-containerregistry v0.21.6 changed .local domain handling to only treat .localhost as HTTP (google/go-containerregistry#2281). This breaks OCI storage for insecure registries using .cluster.local addresses since name.NewDigest() now defaults to HTTPS for them. Extract nameOpts() from newRepo() and reuse it in both NewDigest call sites so the insecure flag propagates consistently. Signed-off-by: ab-ghosh <abghosh@redhat.com>
ab-ghosh
added a commit
to ab-ghosh/chains
that referenced
this pull request
May 26, 2026
go-containerregistry v0.21.6 changed .local domain handling to only treat .localhost as HTTP (google/go-containerregistry#2281). This breaks OCI storage for insecure registries using .cluster.local addresses since name.NewDigest() now defaults to HTTPS for them. Extract nameOpts() from newRepo() and reuse it in both NewDigest call sites so the insecure flag propagates consistently. Signed-off-by: ab-ghosh <abghosh@redhat.com>
3 tasks
tekton-robot
pushed a commit
to tektoncd/chains
that referenced
this pull request
Jun 8, 2026
go-containerregistry v0.21.6 changed .local domain handling to only treat .localhost as HTTP (google/go-containerregistry#2281). This breaks OCI storage for insecure registries using .cluster.local addresses since name.NewDigest() now defaults to HTTPS for them. Extract nameOpts() from newRepo() and reuse it in both NewDigest call sites so the insecure flag propagates consistently. Signed-off-by: ab-ghosh <abghosh@redhat.com>
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.
The
reLocalregex previously matched both.localand.localhostdomain suffixes, treating both as insecure (HTTP) registries. This
caused intermittent failures for users with FQDN registries ending in
.local, as the HTTP fallback path would trigger incorrect redirectbehavior.
Only
.localhostdomains should be treated as non-HTTPS by default,per RFC 6761. Users with
.localdomains that genuinely need HTTPcan still pass the
Insecureoption explicitly.Changes:
pkg/name/registry.go: regex changed from.*\.local(?:host)?(?::\d{1,5})?$to.*\.localhost(?::\d{1,5})?$pkg/name/registry_test.go: updated existing.localtest to.localhost, added two new test cases verifying.localdomains use HTTPSTest results:
Fixes #2139