Visitar URL original
fix(name): anchor loopback registry detection by rohan-patnaik · Pull Request #2314 · google/go-containerregistry · GitHub
Skip to content

fix(name): anchor loopback registry detection - #2314

Merged
Subserial merged 2 commits into
google:mainfrom
rohan-patnaik:fix-loopback-registry-scheme
Jun 2, 2026
Merged

Subserial merged 2 commits into
google:mainfrom
rohan-patnaik:fix-loopback-registry-scheme

Conversation

@rohan-patnaik

Copy link
Copy Markdown
Contributor

Fixes #2313

Summary

This anchors the loopback registry checks used by Registry.Scheme().

Before this change, any registry hostname containing 127.0.0.1 or ::1 as a substring could be treated as loopback and use plain HTTP. Now only the actual loopback forms match: 127.0.0.1, 127.0.0.1:<port>, ::1, and [::1]:<port>.

Why

Non-loopback registries like 127.0.0.1.evil.com or [2001:db8::1]:5000 should keep the default HTTPS scheme. The old unanchored regexes matched those strings accidentally.

Test plan

  • go test ./pkg/name
  • go test ./pkg/...

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.94%. Comparing base (9db1ad6) to head (3ed6819).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2314   +/-   ##
=======================================
  Coverage   56.94%   56.94%           
=======================================
  Files         166      166           
  Lines       11369    11369           
=======================================
  Hits         6474     6474           
  Misses       4134     4134           
  Partials      761      761           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Subserial
Subserial merged commit e8f7b82 into google:main Jun 2, 2026
21 checks passed
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
crane 0.21.7

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## What's Changed
* tarball: return error instead of panicking on missing rootfs.diff_ids by @iahsanGill in google/go-containerregistry#2304
* gcrane: honor --platform flag in copy by @iahsanGill in google/go-containerregistry#2307
* mutate: verify layer digests in Extract and Time by @momenashrafff in google/go-containerregistry#2303
* tarball: close layer readers during Write by @nandbhat in google/go-containerregistry#2308
* build(deps): bump the actions group across 1 directory with 2 updates by @dependabot[bot] in google/go-containerregistry#2311
* build(deps): bump github.com/docker/cli from 29.4.3+incompatible to 29.5.2+incompatible in the go-deps group across 1 directory by @dependabot[bot] in google/go-containerregistry#2312
* BUGFIX: Fail with error when read exceeds maximum by @inteon in google/go-containerregistry#2328
* build(deps): bump the actions group across 1 directory with 2 updates by @dependabot[bot] in google/go-containerregistry#2327
* fix(name): anchor loopback registry detection by @rohan-patnaik in google/go-containerregistry#2314
* Reject symlinks in OCI layout blobs by @mosskappa in google/go-containerregistry#2306
* fix(crane): avoid creating export tar on pull failure by @Haihan-Jiang in google/go-containerregistry#2318
* feat(kubernetes): allow ignoring pull secrets by @rohan-patnaik in google/go-containerregistry#2315
* fix(name): preserve localhost registry references by @rohan-patnaik in google/go-containerregistry#2316
* pkg/registry: export ErrNotFound by @malt3 in google/go-containerregistry#2176
* pkg/registry: export RedirectError by @malt3 in google/go-containerregistry#2177
* build(deps): bump the go-deps group across 1 directory with 2 updates by @dependabot[bot] in google/go-containerregistry#2343
* build(deps): bump the actions group across 1 directory with 2 updates by @dependabot[bot] in google/go-containerregistry#2344
* fix: prevent SSRF in google.List() pagination by @tufstraka in google/go-containerregistry#2332
* internal/gzip: fix goroutine leak in ReadCloserLevel by @amarkdotdev in google/go-containerregistry#2347
* fix(transport): apply refreshed bearer token after cross-host redirect by @64johnlee in google/go-containerregistry#2337
* build(deps): bump the go-deps group across 3 directories with 4 updates by @dependabot[bot] in google/go-containerregistry#2348
* fix(tarball): normalize paths when matching files by @bstoll in google/go-containerregistry#2334
* transport: do not re-attach bearer token after cross-host redirect by @evilgensec in google/go-containerregistry#2349
* Bump CI go version to 1.26.4 by @Subserial in google/go-containerregistry#2350

## New Contributors
* @momenashrafff made their first contribution in google/go-containerregistry#2303
* @nandbhat made their first contribution in google/go-containerregistry#2308
* @inteon made their first contribution in google/go-containerregistry#2328
* @rohan-patnaik made their first contribution in google/go-containerregistry#2314
* @mosskappa made their first contribution in google/go-containerregistry#2306
* @Haihan-Jiang made their first contribution in google/go-containerregistry#2318
* @tufstraka made their first contribution in google/go-containerregistry#2332
* @amarkdotdev made their first contribution in google/go-containerregistry#2347
* @64johnlee made their first contribution in google/go-containerregistry#2337
* @bstoll made their first contribution in google/go-containerregistry#2334

**Full Changelog**: https://github.com/google/go-containerregistry/compare/v0.21.6...v0.21.7</pre>
  <p>View the full release notes at <a href="https://github.com/google/go-containerregistry/releases/tag/v0.21.7">https://github.com/google/go-containerregistry/releases/tag/v0.21.7</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!11861
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.

pkg/name: unanchored loopback regex causes TLS downgrade for hosts containing "127.0.0.1" or "::1" substring

3 participants