transport: block unspecified IPs (0.0.0.0, ::) in validateRealmURL#2285
Merged
Conversation
validateRealmURL checks IsLoopback, IsPrivate, IsLinkLocalUnicast, and IsLinkLocalMulticast but not IsUnspecified. On Linux and macOS, 0.0.0.0 resolves to 127.0.0.1, so a malicious registry can redirect auth requests to localhost by setting realm to https://0.0.0.0:PORT. Add ip.IsUnspecified() to the existing check.
|
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. |
Contributor
Author
|
CLA signed. Please re-check. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2285 +/- ##
==========================================
+ Coverage 56.82% 56.85% +0.03%
==========================================
Files 166 166
Lines 11279 11279
==========================================
+ Hits 6409 6413 +4
+ Misses 4103 4100 -3
+ Partials 767 766 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Subserial
approved these changes
Apr 30, 2026
Subserial
pushed a commit
to Subserial/go-containerregistry
that referenced
this pull request
May 15, 2026
…oogle#2285) * transport: block unspecified IPs (0.0.0.0, ::) in validateRealmURL validateRealmURL checks IsLoopback, IsPrivate, IsLinkLocalUnicast, and IsLinkLocalMulticast but not IsUnspecified. On Linux and macOS, 0.0.0.0 resolves to 127.0.0.1, so a malicious registry can redirect auth requests to localhost by setting realm to https://0.0.0.0:PORT. Add ip.IsUnspecified() to the existing check. * trigger CLA re-check
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.
validateRealmURL checks IsLoopback, IsPrivate, IsLinkLocalUnicast,
and IsLinkLocalMulticast but not IsUnspecified. On Linux and macOS,
0.0.0.0 resolves to 127.0.0.1, so a malicious registry can redirect
auth requests to localhost by setting realm to https://0.0.0.0:PORT.
Add ip.IsUnspecified() to the existing check.
Fixes #2284