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

fix(name): anchor loopback registry detection#2314
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
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